lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adriano Crestani (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LUCENE-1768) NumericRange support for new query parser
Date Wed, 12 Aug 2009 05:21:14 GMT

    [ https://issues.apache.org/jira/browse/LUCENE-1768?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12742223#action_12742223
] 

Adriano Crestani commented on LUCENE-1768:
------------------------------------------

{quote}
The proposed RangeTools seems like a good approach, and I like how it
cleanly absorbs the Date precisions that the old queryParser also
supports.
{quote}

You meant DateTools, right?! I don't see so much difference to use this same approach over
the "option1". You have a map based from field name to the DateTools.Resolution used for that
field. Which is the same feature we want to implement on this JIRA, something you could configure
how you are going to resolve the value defined on a range query based on the field name. The
only difference is that we are expanding the options the user will have to resolve the values:
RangeUtils.NUMERIC, RangeUtils.DATE, RangeUtils.FLOAT, etc...let me know if I missed or missunderstood
something on this part.

{quote}
Here's one side-question, about back compat promises for the new
QueryParser: we are suggesting the users can start from all the
building blocks in StandardQueryParser, and override the processors,
create new nodes, builders, etc. with their own. But this is
potentially dangerous, in that the next version of Lucene might change
things up such that your custom code doesn't work anymore? It's alot
like a core class being subclassed externally, and then change to the
core class break those external subclasses.

EG say we had not handled numerics for 2.9, and users go and do
"option 2" (the quick & dirty, but simplest, way to get
NumericRangeQueries out). Then, say in 3.1 we implement the proposed
fix here ("option 1"). Suddenly, we've altered what nodes come out of
the processor pipeline, because we've created a new NumericRangeQuery
node, and so the builders that users had added, for the RangeQuery
node, will no loner be invoked. How are we going to handle
back-compat here?
{quote}

I think it's already happening with the "old" QP. It used to output RangeQuery objects and
now it outputs TermRangeQuery objects. How is it going to be handled buy users expecting RangeQuery
objects?

The "new" QP builder, delegates a query node based on its class to a builder, if there is
no builder that knows how to build an object from that class it keeps looking up in the class
hierarchy until it finds a builder that knows how to. Query nodes are supposed to be conceptual
objects, they just represent some concept X, and ideally anything that fits in this concept
should inherit from it, this way the user can create their own specific query nodes with no
need to change how they are built (if there is no need for that). What I'm trying to say here
is that if I create a node Y which extends X, I don't need to specify a new YBuilder for it,
the XBuilder will be used. So, ideally, NumericRangeQueryNode should extends RangeQueryNode,
the problem here is that we also need to specify a builder for the NumericRangeNode, and if
the user sets a builder for RangeNode it will never be invoked for NumericRangeNode objects.
Maybe it shouldn't at all, because if a new builder was specified for NumericRangeNode, it
means a new kind of object should be built from it, something the user probably don't know
yet, since it's a new kind of node, and his custom code needs to be updated anyway to support
it.

Howerver, there is a solution for this kind of back-compat problem (which I don't think it
is). In a future release, if a new XRangeQueryNode is created, instead of set

{code}
 luceneBuilderMap.setBuilder(RangeQueryNode.class, new RangeQueryNodeBuilder());
luceneBuilderMap.setBuilder(XRangeQueryNode.class, new XRangeQueryNodeBuilder());
{code}

We could do:

{code}
rangeBuilderMap.setBuilder(RangeQueryNode.class, new RangeQueryNodeBuilder());
rangeBuilderMap.setBuilder(XRangeQueryNode.class, new XRangeQueryNodeBuilder());

// then

luceneBuilderMap.setBuilder(RangeQueryNode.class, rangeBuilderMap);
{code}

This way, if the user reset the RangeQueryNode builder to its own builder, it will still be
called for XRangeQueryNode and RangeQueryNode objects.

Let me know if there is any question about what I just described. 

> NumericRange support for new query parser
> -----------------------------------------
>
>                 Key: LUCENE-1768
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1768
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: QueryParser
>    Affects Versions: 2.9
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>             Fix For: 2.9
>
>
> It would be good to specify some type of "schema" for the query parser in future, to
automatically create NumericRangeQuery for different numeric types? It would then be possible
to index a numeric value (double,float,long,int) using NumericField and then the query parser
knows, which type of field this is and so it correctly creates a NumericRangeQuery for strings
like "[1.567..*]" or "(1.787..19.5]".
> There is currently no way to extract if a field is numeric from the index, so the user
will have to configure the FieldConfig objects in the ConfigHandler. But if this is done,
it will not be that difficult to implement the rest.
> The only difference between the current handling of RangeQuery is then the instantiation
of the correct Query type and conversion of the entered numeric values (simple Number.valueOf(...)
cast of the user entered numbers). Evenerything else is identical, NumericRangeQuery also
supports the MTQ rewrite modes (as it is a MTQ).
> Another thing is a change in Date semantics. There are some strange flags in the current
parser that tells it how to handle dates.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message