com.plumtree.server.search
Class PTSTextQueryParseMode

java.lang.Object
  extended by com.plumtree.server.search.PTSTextQueryParseMode

public class PTSTextQueryParseMode
extends java.lang.Object

An enumeration of ways in which a text (string) query may be parsed.


Field Summary
static PTSTextQueryParseMode ENTIRE_FIELD
          Require this TextQuery to match the entire contents of the field precisely.
static PTSTextQueryParseMode PREFER_PROXIMITY
          Provide behavior similar to SEARCHBOX, but give preference to documents where the query terms appear near each other.
static PTSTextQueryParseMode SEARCHBOX
          Interpret this constraint as a query string entered by a user into a search box, which may contain query operators such as "and" or "or".
static PTSTextQueryParseMode SIMPLE
          Interpret this TextQuery as literally as possible, without supporting query operators.
 
Method Summary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIMPLE

public static final PTSTextQueryParseMode SIMPLE
Interpret this TextQuery as literally as possible, without supporting query operators. If the query has multiple tokens, such as "dog cat", fields will only match the query if they contain the tokens in the same order specified in the query (i.e., as a phrase), anywhere in the field. Query operators are not recognized as operators, i.e. a query for "dog or cat" matches only the phrase "dog or cat".


ENTIRE_FIELD

public static final PTSTextQueryParseMode ENTIRE_FIELD
Require this TextQuery to match the entire contents of the field precisely. For example, a query for "dog cat" would match a field containing only "dog cat", but not a field containing "dog cat mouse". Contrast this with SIMPLE, which would match in both cases.

This mode may be slower than SIMPLE, particularly for the case where the query is a single token. If you have a choice between these modes, SIMPLE is recommended.


SEARCHBOX

public static final PTSTextQueryParseMode SEARCHBOX
Interpret this constraint as a query string entered by a user into a search box, which may contain query operators such as "and" or "or". Query operators are automatically recognized (in the language provided to the IPTSQueryRequest).

For example, the queries "dog and cat" (in English) and "perro y gato" (in Spanish) will require both tokens to be present in the field. "dog or cat" will match a field with either token.

Internet-style syntax, such as "dog +cat -mouse", is also recognized.

If the query contains multiple tokens but no query operators, the AND operator is assumed, i.e. "dog cat" is equivalent to "dog and cat".


PREFER_PROXIMITY

public static final PTSTextQueryParseMode PREFER_PROXIMITY
Provide behavior similar to SEARCHBOX, but give preference to documents where the query terms appear near each other.

This parse mode behaves identically to SEARCHBOX, except for the case where there are multiple tokens but no query operators (e.g. "dog cat"). In this case, documents whose fields contain the tokens in order will rank highest, followed by documents containing the tokens near each other, followed by documents that simply contain all the tokens.

If query operators are present, this mode behaves the same as SEARCHBOX.

You may only use PREFER_PROXIMITY mode for one TextQuery in a single query request, since it affects the global ranking of results.



Copyright © 2008 Plumtree Software Inc. All Rights Reserved.