public class IndexHelper extends Object implements Serializable
| Constructor and Description |
|---|
IndexHelper() |
| Modifier and Type | Method and Description |
|---|---|
static Map<String,Long> |
feedLucene(org.apache.lucene.store.Directory index,
Iterator<PositionalRecordWrapper> iter,
List<String> snippetFields,
Set<String> fields,
int count)
Feeds the lucene index with (maximum count) records that are retrieved from the iter.
|
static org.apache.lucene.store.Directory |
initializeIndex() |
static org.apache.lucene.index.IndexWriter |
initializeIndexWriter(org.apache.lucene.store.Directory index) |
static List<gr.uoa.di.madgik.grs.record.GenericRecord> |
multiget(List<RankedRecord> recs,
org.apache.lucene.store.Directory index,
Set<String> fieldsName)
Performs a multiget on the lucene index from the given list of
RankedRecords |
static Map<String,Pair> |
rankDocuments(org.apache.lucene.store.Directory index,
String query,
int count) |
static Map<String,Pair> |
rankDocuments(org.apache.lucene.store.Directory index,
String query,
int count,
int hitsCount)
Performs the query on the index and returns a map with key the id of the record and value a pair of score and lucene id (different from record id)
Obviously, the returned result is not sorted but it requires sorting on the score
|
public static org.apache.lucene.store.Directory initializeIndex()
throws IOException
IOExceptionpublic static org.apache.lucene.index.IndexWriter initializeIndexWriter(org.apache.lucene.store.Directory index)
throws IOException
IOExceptionpublic static Map<String,Pair> rankDocuments(org.apache.lucene.store.Directory index, String query, int count) throws org.apache.lucene.queryparser.classic.ParseException, IOException
org.apache.lucene.queryparser.classic.ParseExceptionIOExceptionpublic static Map<String,Pair> rankDocuments(org.apache.lucene.store.Directory index, String query, int count, int hitsCount) throws org.apache.lucene.queryparser.classic.ParseException, IOException
index - query - count - hitsCount - org.apache.lucene.queryparser.classic.ParseExceptionIOExceptionpublic static List<gr.uoa.di.madgik.grs.record.GenericRecord> multiget(List<RankedRecord> recs, org.apache.lucene.store.Directory index, Set<String> fieldsName) throws Exception
RankedRecordsrecs - index - fieldsName - GenericRecords retrievedExceptionpublic static Map<String,Long> feedLucene(org.apache.lucene.store.Directory index, Iterator<PositionalRecordWrapper> iter, List<String> snippetFields, Set<String> fields, int count) throws Exception
index - iter - snippetFields - fields - count - ExceptionCopyright © 2016. All Rights Reserved.