|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object uk.ac.gla.dcs.renaissance.mg4j.QueryEngine
public class QueryEngine
A modified version of the QueryEngine (to handle the modified version of the Scorer)
Field Summary | |
---|---|
protected it.unimi.dsi.fastutil.objects.Reference2DoubleOpenHashMap<it.unimi.dsi.mg4j.index.Index> |
index2Weight
A map associating a weight with each index. |
it.unimi.dsi.fastutil.objects.Object2ReferenceMap<String,it.unimi.dsi.mg4j.index.Index> |
indexMap
A map from names to indices. |
it.unimi.dsi.mg4j.query.IntervalSelector |
intervalSelector
The current interval selector, if any. |
boolean |
multiplex
Whether multiplex is active. |
int |
numIndices
The number of indices used by queryParser . |
it.unimi.dsi.mg4j.query.parser.QueryParser |
queryParser
The parser used to parse queries. |
Constructor Summary | |
---|---|
QueryEngine(it.unimi.dsi.mg4j.query.parser.QueryParser queryParser,
it.unimi.dsi.mg4j.query.nodes.QueryBuilderVisitor<it.unimi.dsi.mg4j.search.DocumentIterator> builderVisitor,
it.unimi.dsi.fastutil.objects.Object2ReferenceMap<String,it.unimi.dsi.mg4j.index.Index> indexMap)
Creates a new query engine. |
Method Summary | |
---|---|
QueryEngine |
copy()
|
void |
equalize(int samples)
Activate equalisation with the given number of samples- |
int |
process(it.unimi.dsi.mg4j.query.nodes.Query[] query,
int offset,
int length,
it.unimi.dsi.fastutil.objects.ObjectArrayList<it.unimi.dsi.mg4j.search.score.DocumentScoreInfo<it.unimi.dsi.fastutil.objects.Reference2ObjectMap<it.unimi.dsi.mg4j.index.Index,it.unimi.dsi.mg4j.query.SelectedInterval[]>>> results)
Processes one or more pre-parsed queries and deposits in a given array a segment of the results corresponding to the queries, using the current settings of this query engine. |
int |
process(String queries,
int offset,
int length,
it.unimi.dsi.fastutil.objects.ObjectArrayList<it.unimi.dsi.mg4j.search.score.DocumentScoreInfo<it.unimi.dsi.fastutil.objects.Reference2ObjectMap<it.unimi.dsi.mg4j.index.Index,it.unimi.dsi.mg4j.query.SelectedInterval[]>>> results)
Parses one or more comma-separated queries and deposits in a given array a segment of the results corresponding to the queries, using the current settings of this query engine. |
void |
score(it.unimi.dsi.mg4j.search.score.Scorer[] scorer,
double[] weight)
Sets the scorers for this query engine. |
void |
setWeights(it.unimi.dsi.fastutil.objects.Reference2DoubleMap<it.unimi.dsi.mg4j.index.Index> index2Weight)
Sets the index weights. |
String |
toString()
|
void |
transformer(it.unimi.dsi.mg4j.query.nodes.QueryTransformer transformer)
Sets the transformer for this engine, or disables query transformation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public final it.unimi.dsi.mg4j.query.parser.QueryParser queryParser
public final it.unimi.dsi.fastutil.objects.Object2ReferenceMap<String,it.unimi.dsi.mg4j.index.Index> indexMap
public final int numIndices
queryParser
.
public volatile boolean multiplex
public volatile it.unimi.dsi.mg4j.query.IntervalSelector intervalSelector
protected final it.unimi.dsi.fastutil.objects.Reference2DoubleOpenHashMap<it.unimi.dsi.mg4j.index.Index> index2Weight
Constructor Detail |
---|
public QueryEngine(it.unimi.dsi.mg4j.query.parser.QueryParser queryParser, it.unimi.dsi.mg4j.query.nodes.QueryBuilderVisitor<it.unimi.dsi.mg4j.search.DocumentIterator> builderVisitor, it.unimi.dsi.fastutil.objects.Object2ReferenceMap<String,it.unimi.dsi.mg4j.index.Index> indexMap)
queryParser
- a query parser, or null
if this query engine will just process pre-parsed queries.builderVisitor
- a builder visitor to transform queries into document iterators.indexMap
- a map from symbolic name to indices (used for multiplexing and default weight initialisation).Method Detail |
---|
public QueryEngine copy()
copy
in interface it.unimi.dsi.lang.FlyweightPrototype<QueryEngine>
public void equalize(int samples)
samples
- the number of samples for equalisation, or 0 for no equalisation.public void score(it.unimi.dsi.mg4j.search.score.Scorer[] scorer, double[] weight)
If scorer
has length zero, scoring is disabled. If it has length 1,
the only scorer is used for scoring, and the only element of weight
is
discarded. Otherwise, a LinearAggregator
is used to combine results from
the given scorers, using the given weights.
scorer
- an array of scorers.weight
- a parallel array of weights (not to be confused with index weights).public void transformer(it.unimi.dsi.mg4j.query.nodes.QueryTransformer transformer)
transformer
- a query transformer, or null
to disable query transformation.public void setWeights(it.unimi.dsi.fastutil.objects.Reference2DoubleMap<it.unimi.dsi.mg4j.index.Index> index2Weight)
This method just delegates to Scorer.setWeights(Reference2DoubleMap)
.
index2Weight
- a map from indices to weights.public int process(String queries, int offset, int length, it.unimi.dsi.fastutil.objects.ObjectArrayList<it.unimi.dsi.mg4j.search.score.DocumentScoreInfo<it.unimi.dsi.fastutil.objects.Reference2ObjectMap<it.unimi.dsi.mg4j.index.Index,it.unimi.dsi.mg4j.query.SelectedInterval[]>>> results) throws it.unimi.dsi.mg4j.query.parser.QueryParserException, it.unimi.dsi.mg4j.query.nodes.QueryBuilderVisitorException, IOException
Results are accumulated with an “and-then” semantics: results are added from each query in order, provided they did not appear before.
queries
- one or more queries separated by commas.offset
- the first result to be added to results
.length
- the number of results to be added to results
results
- an array list that will hold all results.
results
.
it.unimi.dsi.mg4j.query.parser.QueryParserException
it.unimi.dsi.mg4j.query.nodes.QueryBuilderVisitorException
IOException
public int process(it.unimi.dsi.mg4j.query.nodes.Query[] query, int offset, int length, it.unimi.dsi.fastutil.objects.ObjectArrayList<it.unimi.dsi.mg4j.search.score.DocumentScoreInfo<it.unimi.dsi.fastutil.objects.Reference2ObjectMap<it.unimi.dsi.mg4j.index.Index,it.unimi.dsi.mg4j.query.SelectedInterval[]>>> results) throws it.unimi.dsi.mg4j.query.nodes.QueryBuilderVisitorException, IOException
Results are accumulated with an “and-then” semantics: results are added from each query in order, provided they did not appear before.
query
- an array of queries.offset
- the first result to be added to results
.length
- the number of results to be added to results
results
- an array list that will hold all results.
results
.
it.unimi.dsi.mg4j.query.nodes.QueryBuilderVisitorException
IOException
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |