it.unimi.di.mg4j.query
Class Query

java.lang.Object
  extended by it.unimi.di.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
static class Query.Command
           
static class Query.OutputType
           
 
Field Summary
static int MAX_STEMMING
           
 
Constructor Summary
Query(QueryEngine queryEngine)
           
 
Method Summary
 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, List<? extends CharSequence> titleList, Marker marker)
          Scores the given document iterator and produces score output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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,
                  List<? extends CharSequence> titleList,
                  Marker marker)
           throws IOException
Scores the given document iterator and produces score output.

Parameters:
results - an iterator returning instances of DocumentScoreInfo.
documentCollection - an optional document collection, or null.
titleList - an optional list of titles, or null.
marker - an optional text marker to mark snippets, or null.
Returns:
the number of documents scanned.
Throws:
IOException

main

public static void main(String[] arg)
                 throws Exception
Throws:
Exception