Name Date Size

.. 2012-12-07 17:08:20 22

build.xml 2012-06-08 22:32:50 5.6 KiB

ivy.xml 2012-06-08 22:32:50 917

README.javacc 2012-06-08 22:32:50 1.9 KiB

README.txt 2012-06-08 22:32:50 1.9 KiB

src 2012-12-07 17:08:16 5

README.javacc

NOTE: often, if you are making a small change to the .jj file, you can
simply run "ant javacc" and skip the steps below. JavaCC will print
warnings like this:
Warning: ParseException.java: File is obsolete. Please rename or delete this file so that a new one can be generated for you.
which you should ignore (ie, simply keep the ParseException.java class
that's already present).
If, instead, you'd like to fully rebuild the StandardQueryParser,
here's how:
* Delete these files:
StandardQueryParser.java
StandardQueryParserConstants.java
StandardQueryParserTokenManager.java
TokenMgrError.java
JavaCharStream.java
Token.java
* Run "ant javacc". That will generate the all the classes
* To avoid lots of warnings in the generated code:
add @SupressWarnings("all"), immediately preceding the class declaration to:
QueryParserTokenManager.java
TokenMgrError.java
JavaCharStream.java
Token.java
JavaCharStream.java
* Remove all imports from TokenMgrError.java
* Fix the ParseException class:
- Change it to extend from QueryNodeParseException:
"public class ParseException extends QueryNodeParseException".
- Recreate the all the constructors like this:
public ParseException(Token currentTokenVal,
int[][] expectedTokenSequencesVal, String[] tokenImageVal) {
super(new MessageImpl(QueryParserMessages.INVALID_SYNTAX, initialise(
currentTokenVal, expectedTokenSequencesVal, tokenImageVal)));
this.currentToken = currentTokenVal;
this.expectedTokenSequences = expectedTokenSequencesVal;
this.tokenImage = tokenImageVal;
}
public ParseException(Message message) {
super(message);
}
public ParseException() {
super(new MessageImpl(QueryParserMessages.INVALID_SYNTAX, "Error"));
}
- Fix all imports

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.