org.galagosearch.core.retrieval.query
Class SimpleQuery

java.lang.Object
  extended by org.galagosearch.core.retrieval.query.SimpleQuery

public class SimpleQuery
extends java.lang.Object

SimpleQuery parses the kind of queries you might expect for a end-user search engine. The format is also meant to be similar to Lucene's query format.

Queries can be single terms:
white house
or phrases:
"white house"
and have fields: title:"white house"
or weights:
white^4 house^2

A query can be parsed into a list of QueryTerms or translated into a tree of Nodes which can be used with the StructuredRetrieval code.

Author:
trevor

Nested Class Summary
static class SimpleQuery.QueryTerm
           
 
Constructor Summary
SimpleQuery()
           
 
Method Summary
static java.util.List<SimpleQuery.QueryTerm> parse(java.lang.String query)
           
static SimpleQuery.QueryTerm parseQueryTerm(java.lang.String term)
          The format of the query term is field:term^weight.
static Node parseTree(java.lang.String query)
           
static java.util.List<java.lang.String> textQueryTerms(java.lang.String query)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleQuery

public SimpleQuery()
Method Detail

parseQueryTerm

public static SimpleQuery.QueryTerm parseQueryTerm(java.lang.String term)
The format of the query term is field:term^weight. Both the field and the weight are optional, and the term may be enclosed in quotes.

Returns:
A QueryTerm object describing the query term.

textQueryTerms

public static java.util.List<java.lang.String> textQueryTerms(java.lang.String query)

parse

public static java.util.List<SimpleQuery.QueryTerm> parse(java.lang.String query)

parseTree

public static Node parseTree(java.lang.String query)


Copyright © 2009. All Rights Reserved.