Package it.unimi.di.big.mg4j.query
Class Query
- java.lang.Object
-
- it.unimi.di.big.mg4j.query.Query
-
public class Query extends Object
A command-line interpreter to query indices.This class can be used to start a query engine from the command line. Optionally, it can start a web server that will serve the results in a search-engine-like environment. Changes to the query engine made on the command line will reflect on subsequent queries (also on the web server). The web server access is fully multithreaded.
This class does not provide command-line history or editing: to get that effect, we suggest to rely on some operating-system utility such as rlwrap.
Warning: This class is highly experimental (it is the place that we tweak to experiment every kind of new indexing/ranking method).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Query.Command
static class
Query.OutputType
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_STEMMING
-
Constructor Summary
Constructors Constructor Description Query(QueryEngine queryEngine)
-
Method Summary
Modifier and Type Method Description boolean
interpretCommand(String line)
Interpret the given command, changing the static variables.static void
main(String[] arg)
int
output(ObjectArrayList<DocumentScoreInfo<Reference2ObjectMap<Index,SelectedInterval[]>>> results, DocumentCollection documentCollection, BigList<? extends CharSequence> titleList, Marker marker)
Scores the given document iterator and produces score output.
-
-
-
Field Detail
-
MAX_STEMMING
public static final int MAX_STEMMING
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Query
public Query(QueryEngine queryEngine)
-
-
Method Detail
-
interpretCommand
public boolean interpretCommand(String line)
Interpret the given command, changing the static variables. See the help printing code for possible commands.- Parameters:
line
- the command line.- Returns:
- false iff we should exit after this command.
-
output
public int output(ObjectArrayList<DocumentScoreInfo<Reference2ObjectMap<Index,SelectedInterval[]>>> results, DocumentCollection documentCollection, BigList<? extends CharSequence> titleList, Marker marker) throws IOException
Scores the given document iterator and produces score output.- Parameters:
results
- an iterator returning instances ofDocumentScoreInfo
.documentCollection
- an optional document collection, ornull
.titleList
- an optional list of titles, ornull
.marker
- an optional text marker to mark snippets, ornull
.- Returns:
- the number of documents scanned.
- Throws:
IOException
-
-