*/
protected Query getRangeQuery(String field, String part1, String part2, boolean inclusive)
throws ParseException {
// get Analyzer from superclass and tokenize the terms
TokenStream source = getAnalyzer().tokenStream(field, new StringReader(part1));
TermAttribute termAtt = (TermAttribute) source.addAttribute(TermAttribute.class);
boolean multipleTokens = false;
// part1
try {
if (source.incrementToken()) {
part1 = termAtt.term();
}
multipleTokens = source.incrementToken();
} catch (IOException e) {
// ignore
}
try {
source.close();
} catch (IOException e) {
// ignore
}
if (multipleTokens) {
throw new ParseException("Cannot build RangeQuery with analyzer " + getAnalyzer().getClass()
+ " - tokens were added to part1");
}
// part2
source = getAnalyzer().tokenStream(field, new StringReader(part2));
termAtt = (TermAttribute) source.addAttribute(TermAttribute.class);
try {
if (source.incrementToken()) {
part2 = termAtt.term();
}
multipleTokens = source.incrementToken();
} catch (IOException e) {
// ignore
}