public class TermQuery extends Object implements QueryNode
QueryNode
for term queries. A term query consists of an index name
and a query term.Modifier and Type | Class and Description |
---|---|
static class |
TermQuery.TermQueryExecutor
A
QueryExecutor for TermQuery nodes. |
Constructor and Description |
---|
TermQuery(QueryEngine.IndexType indexType,
String indexName,
String term,
int length)
Creates a new term query.
|
TermQuery(QueryEngine.IndexType indexType,
String indexName,
String term,
long termId,
int length)
Creates a new term query.
|
TermQuery(String indexName,
String term)
Creates a new term query, for searching over the document text.
|
TermQuery(String annotationType,
String mentionURI,
int length)
Creates a new term query, for searching over semantic annotations.
|
TermQuery(String indexName,
String term,
long termId)
Creates a new term query, for searching over the document text.
|
TermQuery(String annotationType,
String term,
long mentionTermid,
int length)
Creates a new term query, for searching over semantic annotations.
|
Modifier and Type | Method and Description |
---|---|
AtomicIndex |
getIndex(QueryEngine engine)
Gets the index for this query in a given
QueryEngine . |
String |
getIndexName() |
QueryEngine.IndexType |
getIndexType() |
int |
getLength() |
QueryExecutor |
getQueryExecutor(QueryEngine engine)
Gets a new query executor for this
TermQuery . |
CharSequence |
getTerm() |
long |
getTermId() |
String |
toString() |
public TermQuery(String indexName, String term)
indexName
- the name of the index to be searched. This should be one
of the annotation feature names used for indexing tokens (see
IndexConfig.TokenIndexerConfig
).term
- the term to be searched for.IndexConfig.TokenIndexerConfig
public TermQuery(String indexName, String term, long termId)
indexName
- the name of the index to be searched. This should be one
of the annotation feature names used for indexing tokens (see
IndexConfig.TokenIndexerConfig
).termId
- the term ID for the term to be searched for.IndexConfig.TokenIndexerConfig
public TermQuery(String annotationType, String mentionURI, int length)
annotationType
- the type of annotation sought. This should one of the
annotation types used when indexing semantic annotations (see
IndexConfig.SemanticIndexerConfig
).mentionURI
- the URI of the mention sought.length
- the length of the mention sought.public TermQuery(String annotationType, String term, long mentionTermid, int length)
annotationType
- the type of annotation sought. This should one of the
annotation types used when indexing semantic annotations (see
IndexConfig.SemanticIndexerConfig
).mentionTermid
- the term ID for the mentionURI sought.length
- the length of the mention sought.public TermQuery(QueryEngine.IndexType indexType, String indexName, String term, int length)
indexType
- The type of index to be searched.indexName
- the name of the index to be searched. If the indexType is
QueryEngine.IndexType.TOKENS
, then the name is interpreted as the feature name
for the document tokens, if the indexType is QueryEngine.IndexType.ANNOTATIONS
,
then the name is interpreted as annotation type.term
- the term to be searched for.length
- the length of the hits (useful in the case of annotation
indexes, where the length of each mention is stored external to the actual
index).public TermQuery(QueryEngine.IndexType indexType, String indexName, String term, long termId, int length)
indexType
- The type of index to be searched.indexName
- the name of the index to be searched. If the indexType is
QueryEngine.IndexType.TOKENS
, then the name is interpreted as the feature name
for the document tokens, if the indexType is QueryEngine.IndexType.ANNOTATIONS
,
then the name is interpreted as annotation type.length
- the length of the hits (useful in the case of annotation
indexes, where the length of each mention is stored external to the actual
index).termId
- the term ID for sought term.public CharSequence getTerm()
public long getTermId()
public String getIndexName()
public AtomicIndex getIndex(QueryEngine engine)
QueryEngine
.engine
- public QueryExecutor getQueryExecutor(QueryEngine engine) throws IOException
TermQuery
.getQueryExecutor
in interface QueryNode
indexes
- the set of indexes running on.QueryExecutor
(in this case, an instance of
TermQuery.TermQueryExecutor
).IOException
- if the index files cannot be accessed.IllegalArgumentException
- if the provided set of indexes does not
include an index for this query's indexName
.gate.mimir.search.query.QueryNode#getQueryExecutor(java.util.Map)
public QueryEngine.IndexType getIndexType()
public int getLength()
Copyright © 2021 GATE. All rights reserved.