public class PensieveSeeker extends Object implements ITmSeeker, Iterable<TranslationUnit>
| Constructor and Description |
|---|
PensieveSeeker(org.apache.lucene.store.Directory indexDir)
Creates an instance of TMSeeker
|
PensieveSeeker(org.apache.lucene.index.IndexWriter indexWriter)
Creates an instance of TMSeeker.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the searcher
|
protected org.apache.lucene.search.IndexSearcher |
createIndexSearcher() |
org.apache.lucene.store.Directory |
getIndexDir()
Get the current Lucene
Directory |
protected org.apache.lucene.search.IndexSearcher |
getIndexSearcher() |
Iterator<TranslationUnit> |
iterator()
gets an iterator to traverse all translation units in the indexdir
|
protected org.apache.lucene.index.IndexReader |
openIndexReader() |
List<TmHit> |
searchExact(TextFragment query,
Metadata metadata)
Get a list of exact matches for a given text fragment, taking inline codes in account.
|
List<TmHit> |
searchFuzzy(TextFragment query,
int threshold,
int max,
Metadata metadata)
Search for exact and fuzzy matches
|
List<TmHit> |
searchSimpleConcordance(String query,
int threshold,
int max,
Metadata metadata)
Get a list of concordance matches (without position offsets) for a given text string.
|
public PensieveSeeker(org.apache.lucene.store.Directory indexDir)
throws IllegalArgumentException
indexDir - The Directory implementation to use for the queriesIllegalArgumentException - If the indexDir is not setpublic PensieveSeeker(org.apache.lucene.index.IndexWriter indexWriter)
throws IllegalArgumentException
indexWriter - The IndexWriter implementation to use for the queries, needed for NRTIllegalArgumentException - If the indexDir is not setpublic Iterator<TranslationUnit> iterator()
iterator in interface Iterable<TranslationUnit>public org.apache.lucene.store.Directory getIndexDir()
DirectoryDirectoryprotected org.apache.lucene.search.IndexSearcher createIndexSearcher()
throws org.apache.lucene.index.CorruptIndexException,
IOException
org.apache.lucene.index.CorruptIndexExceptionIOExceptionprotected org.apache.lucene.search.IndexSearcher getIndexSearcher()
throws org.apache.lucene.index.CorruptIndexException,
IOException
org.apache.lucene.index.CorruptIndexExceptionIOExceptionprotected org.apache.lucene.index.IndexReader openIndexReader()
throws org.apache.lucene.index.CorruptIndexException,
IOException
org.apache.lucene.index.CorruptIndexExceptionIOExceptionpublic List<TmHit> searchExact(TextFragment query, Metadata metadata)
ITmSeekersearchExact in interface ITmSeekerquery - the fragment to search formetadata - the metadata attributes to also match against, null for no metadata.public List<TmHit> searchFuzzy(TextFragment query, int threshold, int max, Metadata metadata)
searchFuzzy in interface ITmSeekerqueryFrag - the fragment to query.threshold - the minimal score value to return.max - the maximum number of hits to return.metadata - any associated attributes to use for filter.IllegalArgumentException - If threshold is greater than 100 or less than 0public List<TmHit> searchSimpleConcordance(String query, int threshold, int max, Metadata metadata)
ITmSeekersearchSimpleConcordance in interface ITmSeekerquery - the string to search for.threshold - the minimal score value to return.max - the max number of hits returnedmetadata - the metadata attributes to also match against, null for no metadata.public void close()
ITmSeekerclose in interface AutoCloseableclose in interface ITmSeekerCopyright © 2019. All rights reserved.