public interface BlackLabIndex extends Closeable
Modifier and Type | Method and Description |
---|---|
org.apache.lucene.analysis.Analyzer |
analyzer()
Get the analyzer for indexing and searching.
|
default AnnotatedField |
annotatedField(String fieldName) |
default AnnotatedFields |
annotatedFields() |
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.
|
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 docId)
Is the document id in range, and not a deleted document?
|
boolean |
equals(Object obj) |
default QueryExplanation |
explain(BLSpanQuery query)
Explain how a SpanQuery is rewritten to an optimized version to be executed
by Lucene.
|
QueryExplanation |
explain(BLSpanQuery query,
SearchLogger searchLogger)
Explain how a SpanQuery is rewritten to an optimized version to be executed
by Lucene.
|
default QueryExplanation |
explain(QueryInfo queryInfo,
TextPattern pattern,
org.apache.lucene.search.Query filter)
Explain how a TextPattern is converted to a SpanQuery and rewritten to an
optimized version to be executed by Lucene.
|
default Field |
field(String fieldName)
Get a field (either an annotated or a metadata field).
|
default Hits |
find(BLSpanQuery query,
SearchSettings settings)
Find hits for a pattern in a field.
|
Hits |
find(BLSpanQuery query,
SearchSettings settings,
SearchLogger searchLogger)
Find hits for a pattern in a field.
|
default Hits |
find(QueryInfo queryInfo,
TextPattern pattern,
org.apache.lucene.search.Query filter,
SearchSettings settings)
Find hits for a pattern in a field.
|
default Hits |
find(TextPattern pattern,
AnnotatedField field,
org.apache.lucene.search.Query filter)
Deprecated.
use version that takes a QueryInfo
|
default Hits |
find(TextPattern pattern,
org.apache.lucene.search.Query filter)
Deprecated.
use version that takes a QueryInfo
|
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.
|
int |
hashCode() |
File |
indexDirectory()
Get the index directory.
|
boolean |
indexMode()
Are we running in index mode?
|
boolean |
isEmpty()
Is this a newly created, empty index?
|
static boolean |
isIndex(File indexDir)
Does the specified directory contain a BlackLab index?
|
default AnnotatedField |
mainAnnotatedField() |
IndexMetadata |
metadata()
Get information about the structure of the BlackLab index.
|
default MetadataField |
metadataField(String fieldName) |
default MetadataFields |
metadataFields() |
String |
name()
Get the index name.
|
static BlackLabIndex |
open(BlackLabEngine blackLab,
File indexDir)
Open an index for reading ("search mode").
|
static BlackLabIndex |
open(File indexDir)
Deprecated.
use BlackLab.open()
|
default DocResults |
queryDocuments(org.apache.lucene.search.Query documentFilterQuery)
Perform a document query only (no hits)
|
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.
|
default SearchEmpty |
search()
Start building a Search.
|
default SearchEmpty |
search(AnnotatedField field)
Start building a Search.
|
default SearchEmpty |
search(AnnotatedField field,
boolean useCache)
Start building a Search.
|
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 |
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.
|
static boolean isIndex(File indexDir)
indexDir
- the directorystatic BlackLabIndex open(BlackLabEngine blackLab, File indexDir) throws ErrorOpeningIndex
blackLab
- our BlackLab instanceindexDir
- the index directorysettings
- default search settingsErrorOpeningIndex
- on any error@Deprecated static BlackLabIndex open(File indexDir) throws ErrorOpeningIndex
indexDir
- the index directoryErrorOpeningIndex
- on any errorvoid close()
close
in interface AutoCloseable
close
in interface Closeable
boolean isEmpty()
boolean docExists(int docId)
docId
- document id to checkDoc doc(int docId)
docId
- document idvoid forEachDocument(DocTask task)
task
- task to performBLSpanQuery createSpanQuery(QueryInfo queryInfo, TextPattern pattern, org.apache.lucene.search.Query filter) throws InvalidQuery
InvalidQuery
default Hits find(BLSpanQuery query, SearchSettings settings) throws WildcardTermTooBroad
query
- the pattern to findsettings
- search settings, or null for defaultWildcardTermTooBroad
- if a wildcard or regular expression term
is overly broadHits find(BLSpanQuery query, SearchSettings settings, SearchLogger searchLogger) throws WildcardTermTooBroad
query
- the pattern to findsettings
- search settings, or null for defaultsearchLogger
- where to log details about query executionWildcardTermTooBroad
- if a wildcard or regular expression term
is overly broaddefault Hits find(QueryInfo queryInfo, TextPattern pattern, org.apache.lucene.search.Query filter, SearchSettings settings) throws InvalidQuery
queryInfo
- information about the query: field, loggerpattern
- the pattern to findfilter
- determines which documents to searchsettings
- search settings, or null for defaultWildcardTermTooBroad
- if a wildcard or regular expression term
is overly broadInvalidQuery
@Deprecated default Hits find(TextPattern pattern, AnnotatedField field, org.apache.lucene.search.Query filter) throws InvalidQuery
pattern
- the pattern to findfield
- field to find pattern infilter
- determines which documents to searchsettings
- search settings, or null for defaultWildcardTermTooBroad
- if a wildcard or regular expression term
is overly broadInvalidQuery
@Deprecated default Hits find(TextPattern pattern, org.apache.lucene.search.Query filter) throws InvalidQuery
pattern
- the pattern to findfield
- field to find pattern infilter
- determines which documents to searchsettings
- search settings, or null for defaultWildcardTermTooBroad
- if a wildcard or regular expression term
is overly broadInvalidQuery
default DocResults queryDocuments(org.apache.lucene.search.Query documentFilterQuery)
documentFilterQuery
- the document-level queryDocResults queryDocuments(org.apache.lucene.search.Query documentFilterQuery, SearchLogger searchLogger)
documentFilterQuery
- the document-level querysearchLogger
- where to log details about query executionTermFrequencyList termFrequencies(AnnotationSensitivity annotSensitivity, org.apache.lucene.search.Query filterQuery, Set<String> terms)
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 termsdefault QueryExplanation explain(QueryInfo queryInfo, TextPattern pattern, org.apache.lucene.search.Query filter) throws InvalidQuery
queryInfo
- query info, such as the field to searchpattern
- the pattern to explainfilter
- filter query, or null for nonefield
- which field to find the pattern inWildcardTermTooBroad
- if a wildcard or regular expression term
is overly broadInvalidQuery
default QueryExplanation explain(BLSpanQuery query) throws WildcardTermTooBroad
query
- the query to explainWildcardTermTooBroad
- if a wildcard or regular expression term
is overly broadQueryExplanation explain(BLSpanQuery query, SearchLogger searchLogger) throws WildcardTermTooBroad
query
- the query to explainsearchLogger
- where to log details about query optimizationWildcardTermTooBroad
- if a wildcard or regular expression term
is overly broadSearchEmpty search(AnnotatedField field, boolean useCache, SearchLogger searchLogger)
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 loggingdefault SearchEmpty search(AnnotatedField field, boolean useCache)
field
- field to searchuseCache
- whether to use the cache or bypass itdefault SearchEmpty search(AnnotatedField field)
field
- field to searchdefault SearchEmpty search()
field
- field to searchorg.apache.lucene.index.IndexReader reader()
org.apache.lucene.search.IndexSearcher searcher()
ContentAccessor contentAccessor(Field field)
field
- the fieldAnnotationForwardIndex annotationForwardIndex(Annotation annotation)
annotation
- the annotation for which we want the forward indexBlackLabRuntimeException
- if the annotation has no forward indexForwardIndex forwardIndex(AnnotatedField field)
field
- field to get forward index forString name()
File indexDirectory()
IndexMetadata metadata()
default Field field(String fieldName)
fieldName
- name of the fielddefault AnnotatedFields annotatedFields()
default AnnotatedField annotatedField(String fieldName)
default AnnotatedField mainAnnotatedField()
default MetadataFields metadataFields()
default MetadataField metadataField(String fieldName)
SearchSettings searchSettings()
XmlHighlighter.UnbalancedTagsStrategy defaultUnbalancedTagsStrategy()
MatchSensitivity defaultMatchSensitivity()
QueryExecutionContext defaultExecutionContext(AnnotatedField field)
field
- field to searchCollator collator()
org.apache.lucene.analysis.Analyzer analyzer()
ContextSize defaultContextSize()
boolean indexMode()
void setDefaultUnbalancedTagsStrategy(XmlHighlighter.UnbalancedTagsStrategy strategy)
strategy
- the setting: either adding or removing unbalanced tagsvoid setCollator(Collator collator)
collator
- the collatorvoid setDefaultMatchSensitivity(MatchSensitivity m)
m
- default match sensitivityvoid setSearchSettings(SearchSettings settings)
settings
- desired settingsvoid setDefaultContextSize(ContextSize size)
size
- default context sizevoid setCache(SearchCache cache)
cache
- cache object to useSearchCache cache()
BlackLabEngine blackLab()
Copyright © 2020 Instituut voor Nederlandse Taal (INT). All rights reserved.