DOCUMENT_TYPE - the type of document one wants to retrieve.KEY_TYPE - the type of key that is going to be extracted out of
documents and is searchable (needs hashCode&equals implementations).public final class InvertedIndex<DOCUMENT_TYPE,KEY_TYPE> extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
InvertedIndex.DocumentDistanceMeasurer<DOCUMENT_TYPE,KEY_TYPE>
Measurer that measures distance of two documents.
|
static interface |
InvertedIndex.DocumentMapper<DOCUMENT_TYPE,KEY_TYPE>
Mapper that maps a document to its keys.
|
| Modifier and Type | Method and Description |
|---|---|
void |
build(List<DOCUMENT_TYPE> items)
Builds this inverted index.
|
static <KEY_TYPE,DOCUMENT_TYPE> |
create(InvertedIndex.DocumentMapper<DOCUMENT_TYPE,KEY_TYPE> mapper,
InvertedIndex.DocumentDistanceMeasurer<DOCUMENT_TYPE,KEY_TYPE> measurer)
Create an inverted index out of two mapping interfaces: a mapper that maps
documents to its key parts and a distance measurer that measures distance
between two documents.
|
static InvertedIndex<de.jungblut.math.DoubleVector,Integer> |
createVectorIndex(DistanceMeasurer measurer)
Creates an inverted index for vectors (usually sparse vectors are used)
that maps dimensions to the corresponding vectors if they are non-zero.
|
List<DistanceResult<DOCUMENT_TYPE>> |
query(DOCUMENT_TYPE document)
Queries this invertex index.
|
List<DistanceResult<DOCUMENT_TYPE>> |
query(DOCUMENT_TYPE document,
double minDistance)
Queries this invertex index.
|
List<DistanceResult<DOCUMENT_TYPE>> |
query(DOCUMENT_TYPE document,
int maxResults,
double minDistance)
Queries this inverted index.
|
public void build(List<DOCUMENT_TYPE> items)
items - the items that needs to be indexed.public List<DistanceResult<DOCUMENT_TYPE>> query(DOCUMENT_TYPE document)
document - the document to query withpublic List<DistanceResult<DOCUMENT_TYPE>> query(DOCUMENT_TYPE document, double minDistance)
document - the document to query withminDistance - the minimum (lower than: <=) distance the items should
have.public List<DistanceResult<DOCUMENT_TYPE>> query(DOCUMENT_TYPE document, int maxResults, double minDistance)
document - the document to query with-maxResults - the maximum number of results to obtain.minDistance - the minimum (lower than: <=) distance the items should
have.public static <KEY_TYPE,DOCUMENT_TYPE> InvertedIndex<DOCUMENT_TYPE,KEY_TYPE> create(InvertedIndex.DocumentMapper<DOCUMENT_TYPE,KEY_TYPE> mapper, InvertedIndex.DocumentDistanceMeasurer<DOCUMENT_TYPE,KEY_TYPE> measurer)
mapper - the InvertedIndex.DocumentMapper.measurer - the InvertedIndex.DocumentDistanceMeasurer.public static InvertedIndex<de.jungblut.math.DoubleVector,Integer> createVectorIndex(DistanceMeasurer measurer)
measurer - the distance measurer on two vectors.Copyright © 2016. All rights reserved.