public static class SequenceQuery.SequenceQueryExecutor extends AbstractIntersectionQueryExecutor
Modifier and Type | Field and Description |
---|---|
protected List<Binding>[] |
candidateHits
An array of lists of hits, one list for each of the
AbstractIntersectionQueryExecutor.executors . |
protected List<Binding[]> |
hitsOnCurrentDocument
A list of hits on the current document.
|
executors, indices, nextDocIDs, nodes
closed, engine, latestDocument, queryNode
Constructor and Description |
---|
SequenceQueryExecutor(SequenceQuery query,
QueryEngine engine) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this
QueryExecutor and releases all resources used. |
protected static int |
computeMark(int minStart,
int maxStart,
Binding[] hits,
int[] marks)
Computes the mark for a current hit.
|
protected static void |
extractHitsRec(SequenceQuery query,
List<Binding[]> results,
Binding[][] hits,
int[][] marks,
int currentSlot,
int currentHit,
Binding[] slots)
Recursively extracts the hits
|
protected void |
getHitsOnCurrentDocumentOldBCK()
Attempts to find all the matches on the current document.
|
protected void |
getHitsOnCurrentDocumentv2() |
protected void |
getHitsOnCurrentDocumentv3() |
long |
nextDocument(long greaterThan)
Gets the next document that contains a match, with a document ID greater
than the ID provided in the
from parameter. |
Binding |
nextHit()
Gets the next matching position, in the document last returned by
DocumentIterator.nextDocument() . |
accept, acceptOnTruePaths, indices
dispose, document, getLatestDocument, getQueryEngine, getQueryNode, intervalIterator, intervalIterator, intervalIterators, mayHaveNext, nextDocument, skipTo, weight, weight
protected List<Binding[]> hitsOnCurrentDocument
protected List<Binding>[] candidateHits
AbstractIntersectionQueryExecutor.executors
.public SequenceQueryExecutor(SequenceQuery query, QueryEngine engine) throws IOException
engine
- query
- IOException
public void close() throws IOException
QueryExecutor
QueryExecutor
and releases all resources used.close
in interface QueryExecutor
close
in class AbstractIntersectionQueryExecutor
IOException
- if the index files cannot be accessed.public long nextDocument(long greaterThan) throws IOException
QueryExecutor
from
parameter.
This method essentially requests the query executor to skip over a number
of documents that are not desired for external reasons (e.g. when running
a complex query, other query constraints may have already removed a set of
documents from the candidate list).
The query executor will never roll back: all document IDs returned
are in ascending order. This means that if the value provided for the
greaterThan
parameter is lower than the latest document ID
returned, it will have no effect.nextDocument
in interface QueryExecutor
nextDocument
in class AbstractIntersectionQueryExecutor
greaterThan
- a document ID representing the lowest bound (exclusive) for
the requested document ID.greaterThan
, or -1
if no more matching documents
are found.IOException
- if the index files cannot be accessed.protected void getHitsOnCurrentDocumentv3() throws IOException
IOException
protected static void extractHitsRec(SequenceQuery query, List<Binding[]> results, Binding[][] hits, int[][] marks, int currentSlot, int currentHit, Binding[] slots)
hits
- the arrays of hits, one row for each of the AbstractIntersectionQueryExecutor.executors
.marks
- the marks for the hitscurrentSlot
- which slot to fill at this stage (used for recursion).currentHit
- for the current slot, which candidate hit to start from.slots
- the array of slots that needs filling.computeMark(int, int, Binding[], int[])
protected static int computeMark(int minStart, int maxStart, Binding[] hits, int[] marks)
minStart
- the minimum acceptable start position for the next hitmaxStart
- the maximum acceptable start position for the next hithits
- the list of candidate hits (hits on the next slot)marks
- the list of marks for the candidate hitsprotected void getHitsOnCurrentDocumentv2() throws IOException
IOException
protected void getHitsOnCurrentDocumentOldBCK() throws IOException
#nextDocument(int)
are the
same (the current document).
This method will use hits from the candidateHits
array (and
replenish any hit lists as necessary). In the process it will discard
any hits from those lists that are not useful (refer to lower documentIDs
or are not accepted by the gap restrictions).
When the method returns, all the possible hits on the current document
have been saved in the hitsOnCurrentDocument
list.
This method is a non-recursive implementation of the backtracking
algorithm.IOException
public Binding nextHit() throws IOException
QueryExecutor
DocumentIterator.nextDocument()
. Hits are always returned in increasing order
of start offset, but hits that start at the same place may be returned in
any order (i.e. not necessarily longest first or shortest first).Binding
corresponding to the root query node for this
executor. If no further matches are possible on the current document, then
null
is returned.IOException
- if the index files cannot be accessed.Copyright © 2021 GATE. All rights reserved.