public class MockBlackLabIndex extends Object implements BlackLabIndex
Constructor and Description |
---|
MockBlackLabIndex() |
Modifier and Type | Method and Description |
---|---|
org.apache.lucene.analysis.Analyzer |
analyzer()
Get the analyzer for indexing and searching.
|
AnnotationForwardIndex |
annotationForwardIndex(Annotation annotation)
Tries to get the ForwardIndex object for the specified fieldname.
|
BlackLabEngine |
blackLab()
Get the BlackLab instance that created us.
|
SearchCache |
cache() |
void |
close()
Finalize the index object.
|
Collator |
collator()
Get the collator being used for sorting.
|
ContentAccessor |
contentAccessor(Field field)
Get the content accessor for a field.
|
QueryInfo |
createDefaultQueryInfo() |
BLSpanQuery |
createSpanQuery(QueryInfo queryInfo,
TextPattern pattern,
org.apache.lucene.search.Query filter) |
ContextSize |
defaultContextSize()
Get the default context size.
|
QueryExecutionContext |
defaultExecutionContext(AnnotatedField field)
Get the default initial query execution context.
|
MatchSensitivity |
defaultMatchSensitivity() |
XmlHighlighter.UnbalancedTagsStrategy |
defaultUnbalancedTagsStrategy()
How do we fix well-formedness for snippets of XML?
|
Doc |
doc(int docId)
Get a BlackLab document.
|
boolean |
docExists(int doc)
Is the document id in range, and not a deleted document?
|
QueryExplanation |
explain(BLSpanQuery query,
SearchLogger searchLogger)
Explain how a SpanQuery is rewritten to an optimized version to be executed
by Lucene.
|
Hits |
find(BLSpanQuery query,
SearchSettings settings,
SearchLogger searchLogger)
Find hits for a pattern in a field.
|
void |
forEachDocument(DocTask task)
Perform a task on each (non-deleted) Lucene Document.
|
ForwardIndex |
forwardIndex(AnnotatedField field)
Get forward index for the specified annotated field.
|
File |
indexDirectory()
Get the index directory.
|
boolean |
indexMode()
Are we running in index mode?
|
boolean |
isEmpty()
Is this a newly created, empty index?
|
IndexMetadata |
metadata()
Get information about the structure of the BlackLab index.
|
String |
name()
Get the index name.
|
DocResults |
queryDocuments(org.apache.lucene.search.Query documentFilterQuery,
SearchLogger searchLogger)
Perform a document query only (no hits)
|
org.apache.lucene.index.IndexReader |
reader()
Get the Lucene index reader we're using.
|
SearchEmpty |
search(AnnotatedField field,
boolean useCache,
SearchLogger searchLogger)
Start building a Search.
|
org.apache.lucene.search.IndexSearcher |
searcher() |
SearchSettings |
searchSettings()
The default settings for all new Hits objects.
|
void |
setCache(SearchCache cache)
Set the object BlackLab should use as cache.
|
void |
setCollator(Collator collator)
Set the collator used for sorting.
|
void |
setDefaultContextSize(ContextSize size)
Set the default context size.
|
void |
setDefaultMatchSensitivity(MatchSensitivity m)
Set the default sensitivity for queries.
|
void |
setDefaultUnbalancedTagsStrategy(XmlHighlighter.UnbalancedTagsStrategy strategy)
Set how to fix well-formedness for snippets of XML.
|
void |
setForwardIndex(Annotation fieldPropName,
AnnotationForwardIndex forwardIndex) |
void |
setIndexSearcher(org.apache.lucene.search.IndexSearcher searcher) |
void |
setSearchSettings(SearchSettings settings)
Set the maximum number of hits to process/count.
|
TermFrequencyList |
termFrequencies(AnnotationSensitivity annotSensitivity,
org.apache.lucene.search.Query filterQuery,
Set<String> terms)
Determine the term frequencies for an annotation sensitivity.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
annotatedField, annotatedFields, equals, explain, explain, field, find, find, find, find, hashCode, isIndex, mainAnnotatedField, metadataField, metadataFields, open, open, queryDocuments, search, search, search
public QueryInfo createDefaultQueryInfo()
public void close()
BlackLabIndex
close
in interface Closeable
close
in interface AutoCloseable
close
in interface BlackLabIndex
public boolean isEmpty()
BlackLabIndex
isEmpty
in interface BlackLabIndex
public Doc doc(int docId)
BlackLabIndex
doc
in interface BlackLabIndex
docId
- document idpublic boolean docExists(int doc)
BlackLabIndex
docExists
in interface BlackLabIndex
doc
- document id to checkpublic org.apache.lucene.index.IndexReader reader()
BlackLabIndex
reader
in interface BlackLabIndex
public QueryExecutionContext defaultExecutionContext(AnnotatedField field)
BlackLabIndex
defaultExecutionContext
in interface BlackLabIndex
field
- field to searchpublic String name()
BlackLabIndex
name
in interface BlackLabIndex
public File indexDirectory()
BlackLabIndex
indexDirectory
in interface BlackLabIndex
public DocResults queryDocuments(org.apache.lucene.search.Query documentFilterQuery, SearchLogger searchLogger)
BlackLabIndex
queryDocuments
in interface BlackLabIndex
documentFilterQuery
- the document-level querysearchLogger
- where to log details about query executionpublic org.apache.lucene.search.IndexSearcher searcher()
searcher
in interface BlackLabIndex
public void setIndexSearcher(org.apache.lucene.search.IndexSearcher searcher)
public void setForwardIndex(Annotation fieldPropName, AnnotationForwardIndex forwardIndex)
public SearchSettings searchSettings()
BlackLabIndex
searchSettings
in interface BlackLabIndex
public XmlHighlighter.UnbalancedTagsStrategy defaultUnbalancedTagsStrategy()
BlackLabIndex
defaultUnbalancedTagsStrategy
in interface BlackLabIndex
public void setDefaultUnbalancedTagsStrategy(XmlHighlighter.UnbalancedTagsStrategy strategy)
BlackLabIndex
setDefaultUnbalancedTagsStrategy
in interface BlackLabIndex
strategy
- the setting: either adding or removing unbalanced tagspublic void setCollator(Collator collator)
BlackLabIndex
setCollator
in interface BlackLabIndex
collator
- the collatorpublic Collator collator()
BlackLabIndex
collator
in interface BlackLabIndex
public IndexMetadata metadata()
BlackLabIndex
metadata
in interface BlackLabIndex
public void forEachDocument(DocTask task)
BlackLabIndex
forEachDocument
in interface BlackLabIndex
task
- task to performpublic Hits find(BLSpanQuery query, SearchSettings settings, SearchLogger searchLogger) throws org.apache.lucene.search.BooleanQuery.TooManyClauses
BlackLabIndex
find
in interface BlackLabIndex
query
- the pattern to findsettings
- search settings, or null for defaultsearchLogger
- where to log details about query executionorg.apache.lucene.search.BooleanQuery.TooManyClauses
public QueryExplanation explain(BLSpanQuery query, SearchLogger searchLogger) throws org.apache.lucene.search.BooleanQuery.TooManyClauses
BlackLabIndex
explain
in interface BlackLabIndex
query
- the query to explainsearchLogger
- where to log details about query optimizationorg.apache.lucene.search.BooleanQuery.TooManyClauses
public ContentAccessor contentAccessor(Field field)
BlackLabIndex
contentAccessor
in interface BlackLabIndex
field
- the fieldpublic AnnotationForwardIndex annotationForwardIndex(Annotation annotation)
BlackLabIndex
annotationForwardIndex
in interface BlackLabIndex
annotation
- the annotation for which we want the forward indexpublic ForwardIndex forwardIndex(AnnotatedField field)
BlackLabIndex
forwardIndex
in interface BlackLabIndex
field
- field to get forward index forpublic MatchSensitivity defaultMatchSensitivity()
defaultMatchSensitivity
in interface BlackLabIndex
public void setDefaultMatchSensitivity(MatchSensitivity m)
BlackLabIndex
setDefaultMatchSensitivity
in interface BlackLabIndex
m
- default match sensitivitypublic org.apache.lucene.analysis.Analyzer analyzer()
BlackLabIndex
analyzer
in interface BlackLabIndex
public void setSearchSettings(SearchSettings settings)
BlackLabIndex
setSearchSettings
in interface BlackLabIndex
settings
- desired settingspublic void setDefaultContextSize(ContextSize size)
BlackLabIndex
setDefaultContextSize
in interface BlackLabIndex
size
- default context sizepublic ContextSize defaultContextSize()
BlackLabIndex
defaultContextSize
in interface BlackLabIndex
public boolean indexMode()
BlackLabIndex
indexMode
in interface BlackLabIndex
public TermFrequencyList termFrequencies(AnnotationSensitivity annotSensitivity, org.apache.lucene.search.Query filterQuery, Set<String> terms)
BlackLabIndex
termFrequencies
in interface BlackLabIndex
annotSensitivity
- the annation + sensitivity indexing we want the term frequency forfilterQuery
- document filter, or null for all documentsterms
- a list of terms to retrieve frequencies for, or null/empty to retrieve frequencies for all termspublic SearchEmpty search(AnnotatedField field, boolean useCache, SearchLogger searchLogger)
BlackLabIndex
search
in interface BlackLabIndex
field
- field to searchuseCache
- whether to use the cache or bypass itsearchLogger
- where to log details about how the search was executed, or null to skip this loggingpublic void setCache(SearchCache cache)
BlackLabIndex
setCache
in interface BlackLabIndex
cache
- cache object to usepublic SearchCache cache()
cache
in interface BlackLabIndex
public BLSpanQuery createSpanQuery(QueryInfo queryInfo, TextPattern pattern, org.apache.lucene.search.Query filter) throws RegexpTooLarge
createSpanQuery
in interface BlackLabIndex
RegexpTooLarge
public BlackLabEngine blackLab()
BlackLabIndex
blackLab
in interface BlackLabIndex
Copyright © 2020 Instituut voor Nederlandse Taal (INT). All rights reserved.