com.sun.labs.minion.test
Class QueryTest

java.lang.Object
  extended by com.sun.labs.minion.test.SEMain
      extended by com.sun.labs.minion.test.QueryTest

public class QueryTest
extends SEMain

QueryTest is a set of utility methods and a query interface to operate on an index. Run QueryTest with the "-d " option specifying an index directory. Queries can be issued by simply typing the query and hitting return. By default, the top 10 results are displayed. Each line will show the partition number, document ID (within the partition), and the document key that was specified at indexing time. The data displayed can be changed with the ":display" command. Arguments to the display command can be the names of any saved field or any of the following:

In addition, you can put "\n" or "\t" for a newline or a space. Arguments should be separated with spaces. The number of results displayed can be changed with the ":n" command.

By default, results are sorted according to their score. Results with the highest score are printed first. The sorting specification can be changed by using the ":sort" command and giving it a sorting spec, as defined in the SearchEngine interface. To get the default sort back, use ":sort -score".

To see the full set of commands available, use the ":help" command. To exit QueryTest cleanly, use the ":q" command.


Nested Class Summary
protected  class QueryTest.DisplaySpec
          A class that is used to format for display the information from a document hit.
 
Field Summary
protected  boolean complexPassDisplay
           
protected  Unsupervised.Model currModel
           
protected static boolean DEBUG
           
protected  boolean displayPassage
           
protected  QueryTest.DisplaySpec displaySpec
           
protected  SearchEngineImpl engine
           
protected  int grammar
           
protected  java.util.logging.Logger logger
           
protected static java.lang.String logTag
           
protected  PartitionManager manager
           
protected  LiteMorph morphEn
           
protected  int nHits
           
protected  long nQueries
           
protected  java.io.PrintStream output
           
protected  java.lang.String prompt
           
protected  int queryOp
           
protected  java.text.DecimalFormat scoreForm
           
protected  Searcher searcher
           
protected  java.lang.String sortSpec
           
protected  long totalTime
           
protected  boolean ttyInput
           
protected  boolean vectorLengthNormalization
           
protected  boolean wildCaseSensitive
           
 
Constructor Summary
QueryTest(java.net.URL cmFile, java.lang.String indexDir, java.lang.String engineType, java.lang.String ds, java.lang.String ss, java.io.PrintStream output)
           
 
Method Summary
 void displayResults(ResultSet set)
           
 void displayResults(java.lang.String prefix, ResultSet set)
          Displays the top n results from a set of results.
 void help()
           
static void main(java.lang.String[] args)
           
protected  java.lang.String[] parseMessage(java.lang.String message)
          Parses the given message into an array of strings.
protected  int processCommand(java.lang.String q)
           
protected  void queryStats()
           
 void setPrompt()
          Sets the prompt to show which of the toggles are on.
 void stats()
           
static void usage()
           
 
Methods inherited from class com.sun.labs.minion.test.SEMain
makeDocument
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected java.util.logging.Logger logger

logTag

protected static final java.lang.String logTag
See Also:
Constant Field Values

DEBUG

protected static final boolean DEBUG
See Also:
Constant Field Values

scoreForm

protected java.text.DecimalFormat scoreForm

displayPassage

protected boolean displayPassage

complexPassDisplay

protected boolean complexPassDisplay

wildCaseSensitive

protected boolean wildCaseSensitive

vectorLengthNormalization

protected boolean vectorLengthNormalization

displaySpec

protected QueryTest.DisplaySpec displaySpec

sortSpec

protected java.lang.String sortSpec

prompt

protected java.lang.String prompt

searcher

protected Searcher searcher

engine

protected SearchEngineImpl engine

manager

protected PartitionManager manager

morphEn

protected LiteMorph morphEn

nHits

protected int nHits

totalTime

protected long totalTime

nQueries

protected long nQueries

grammar

protected int grammar

queryOp

protected int queryOp

ttyInput

protected boolean ttyInput

currModel

protected Unsupervised.Model currModel

output

protected java.io.PrintStream output
Constructor Detail

QueryTest

public QueryTest(java.net.URL cmFile,
                 java.lang.String indexDir,
                 java.lang.String engineType,
                 java.lang.String ds,
                 java.lang.String ss,
                 java.io.PrintStream output)
          throws java.io.IOException,
                 SearchEngineException
Throws:
java.io.IOException
SearchEngineException
Method Detail

help

public void help()

usage

public static void usage()

stats

public void stats()

setPrompt

public void setPrompt()
Sets the prompt to show which of the toggles are on.


displayResults

public void displayResults(ResultSet set)

displayResults

public void displayResults(java.lang.String prefix,
                           ResultSet set)
Displays the top n results from a set of results.


queryStats

protected void queryStats()

parseMessage

protected java.lang.String[] parseMessage(java.lang.String message)
Parses the given message into an array of strings.

Parameters:
message - the string to be parsed.
Returns:
the parsed message as an array of strings

processCommand

protected int processCommand(java.lang.String q)

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException,
                        java.lang.NumberFormatException,
                        SearchEngineException
Throws:
java.io.IOException
java.lang.NumberFormatException
SearchEngineException