lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <>
Subject basic questions on the new QueryParser
Date Mon, 03 Aug 2009 18:12:27 GMT
I'm trying to get started with the new (flexible) QueryParser, in

I see the "original" package, and the useful OriginalQueryParserHelper
within there, that are meant to ease the transition off of the old
QueryParser to the new one.

First question: is the original package also intended to be Lucene's
"default" QueryParser, going forward?  Ie, most users will simply want
to get Lucene's default QueryParser and parse text into Query objs,
and then expert users will directly use core.* to make their own query

If so, maybe we should rename "OriginalQueryParserHelper" to
"DefaultQueryParser" and perhaps move it up into oal.queryParser?

Second question: say I wanted to start with the DefaultQueryParser,
but tweak how it produces range queries.  EG the old QueryParser
attempted to parse the lower/upper bounds as Date, and then re-encodes
them using DateTools (LUCENE-1768 is already open to do this plus
NumericQuery "for real"... I'm just using it as a use case of how an
outside consumer of this API could tweak the default QueryParser).

If I want to do this using the new QueryParser, could I:

  * First get the DefaultQueryParser

  * Call getQueryBuilder to get its QueryBuilder

  * Call QueryBuilder.setBuilder(RangeQueryNode.class, new
    MyRangeQueryNodeBuilder()), where MyRangeQueryNodeBuilder is my
    new class that handles the dates.


Ie, is that (swapping in your own QueryBuilder) the right way to tweak
how the DefaultQueryParser would create queries?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message