lucene/contrib/surround
Uwe Schindler 3645281a5d Update JavaCC parser task to Java 1.5 and regenerate files.
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@826549 13f79535-47bb-0310-9956-ffa450edef68
2009-10-18 23:21:13 +00:00
..
src Update JavaCC parser task to Java 1.5 and regenerate files. 2009-10-18 23:21:13 +00:00
README.txt LUCENE-1563:Add example test case for surround query language 2009-03-24 12:28:13 +00:00
build.xml LUCENE-1851: Change 'javacc' and 'clean-javacc' targets to build and clean contrib/surround files. 2009-08-25 22:14:07 +00:00
pom.xml.template bulk fix svn:eol-style to native for text files 2009-06-22 22:18:56 +00:00

README.txt

Description of Surround:

Surround consists of operators (uppercase/lowercase):

AND/OR/NOT/nW/nN/() as infix and
AND/OR/nW/nN        as prefix.

Distance operators W and N have default n=1, max 99.
Implemented as SpanQuery with slop = (n - 1).
An example prefix form is:

20n(aa*, bb*, cc*)

The name Surround was chosen because of this prefix form
and because it uses the newly introduced span queries
to implement the proximity operators.
The names of the operators and the prefix and suffix
forms have been borrowed from various other query
languages described on the internet.


Query terms from the Lucene standard query parser:

field:termtext
^ boost
* internal and suffix truncation
? one character


Some examples:

aa
aa and bb
aa and bb or cc        same effect as:  (aa and bb) or cc
aa NOT bb NOT cc       same effect as:  (aa NOT bb) NOT cc

and(aa,bb,cc)          aa and bb and cc
99w(aa,bb,cc)          ordered span query with slop 98
99n(aa,bb,cc)          unordered span query with slop 98

20n(aa*,bb*)
3w(a?a or bb?, cc*)

title: text: aa
title : text : aa or bb
title:text: aa not bb
title:aa not text:bb

cc 3w dd               infix: dual.

cc N dd N ee           same effect as:   (cc N dd) N ee

text: aa 3d bb

For examples on using the Surround language, see the
test packages.


Development status

Not tested: multiple fields, internally mapped to OR queries,
not compared to Lucene's MultipleFieldQuery.

* suffix truncation is implemented very similar to Lucene's PrefixQuery.

Wildcards (? and internal *) are implemented with regular expressions
to allow further variations. A reimplementation using
WildCardTermEnum (correct name?) should be no problem.

Warnings about missing terms are sent to System.out, this might
be replaced by another stream, and tested for in the tests.

BooleanQueryTst.TestCollector uses a results checking method that should
be replaced by the checking method from Lucene's TestBasics.java.