You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Adriano Crestani <ad...@gmail.com> on 2011/05/08 22:24:48 UTC

Re: Small issue in queryparser // ParametricRangeQueryNode.java

Hi Karsten,

No, AFAIK, no one is working on such feature, feel free to work on it, I am
sure there are many people waiting for such feature :)

Now, about the contradiction you mentioned below, I can't see it in the
code:

because
 (upperBound == lowerBound
 &&
 !upperBound.getField().equals(lowerBound.getField()))
 is a contradiction)

Can you explain more on this problem you see in the code?

Also, what you think that should be the constraint condition does not make
sense for me. The contraints asserts whether the upper and lower bounds have
the same field name, correct?! The condition you proposed below would not
throw an exception if upper.getField() is NULL and lower is something else,
which is wrong, an exception should be thrown, since the field names are
different.

most possible it should be

   if(upperBound.getField() == null
      ||
      (upperBound.getField() != lowerBound.getField()
       && !upperBound.getField().equals(
           lowerBound.getField()))) {
     throw new IllegalArgumentException(
     ...


Am I missing something?

Best Regards,
Adriano Crestani


On Sun, May 8, 2011 at 1:00 PM, Karsten Fissmer <ka...@gmx.de> wrote:

> Hi Michael Busch,
>
> The Class ParametricRangeQueryNode was inserted in svn with LUCENE-1567
> "New flexible query parser".
>
> The constructor
>  public ParametricRangeQueryNode(ParametricQueryNode lowerBound,
>      ParametricQueryNode upperBound) {
> has a constraint about his parameters:
>
>    if (upperBound.getField() != lowerBound.getField()
>        || (upperBound.getField() != null && !upperBound.getField().equals(
>            lowerBound.getField()))) {
>      throw new IllegalArgumentException(
>      ...
>
> most possible it should be
>
>    if(upperBound.getField() == null
>       ||
>       (upperBound.getField() != lowerBound.getField()
>        && !upperBound.getField().equals(
>            lowerBound.getField()))) {
>      throw new IllegalArgumentException(
>      ...
> (
>  because
>  (upperBound == lowerBound
>  &&
>  !upperBound.getField().equals(lowerBound.getField()))
>  is a contradiction)
> )
>
> Best regards
>
>  Karsten
>  http://www.xing.com/profile/Karsten_Fissmer
>
>
> P.S. currently I am working with SpanQueries in the queryparser-module, so
> I wrote e.g. SpanNearQueryNode. Is this work already down by someone else?
>

Re: Small issue in queryparser // ParametricRangeQueryNode.java

Posted by Adriano Crestani <ad...@gmail.com>.
Hi Karsten,

Sorry for taking so long to reply.

I am still not 100% sure what behavior you expect exactly from
ParametricRangeQueryNode constructor.

To help to solve our understading problem, I created a simple JUnit
(attached) that tests the behavior I expect. Please, go ahead and change it
the way you expect ;)

Please, on your next replies, copy Lucene dev mailing list, they might help
on your questions as well.

Best Regards,
Adriano Crestani

On Mon, May 9, 2011 at 7:05 AM, <ka...@gmx.de> wrote:

> Hi Adriano,
>
> at time ParametricRangeQueryNode(lowerBound, upperBound) works only if both
> parameters have the same instance as fieldname (==). If it is only the same
> text (equals) the IllegalArgumentException is thrown.
>
> why contradiction:
> because upperBound == lowerBound (and lowerBound != null) implicates
> upperBound.equals(lowerBound)
>
> my suggestion and "upper.getField() is NULL":
> In this case the IllegalArgumentException would be thrown.
> (and also for lower.getField() is NULL)
>
> Best regards
>  Karsten
>
> -------- --------
> > Datum: Sun, 8 May 2011 16:24:48 -0400
> > Adriano Crestani <ad...@gmail.com>
> > subject: Re: Small issue in queryparser // ParametricRangeQueryNode.java
>
> > Hi Karsten,
> >
> > No, AFAIK, no one is working on such feature, feel free to work on it, I
> > am
> > sure there are many people waiting for such feature :)
> >
> > Now, about the contradiction you mentioned below, I can't see it in the
> > code:
> >
> > because
> >  (upperBound == lowerBound
> >  &&
> >  !upperBound.getField().equals(lowerBound.getField()))
> >  is a contradiction)
> >
> > Can you explain more on this problem you see in the code?
> >
> > Also, what you think that should be the constraint condition does not
> make
> > sense for me. The contraints asserts whether the upper and lower bounds
> > have
> > the same field name, correct?! The condition you proposed below would not
> > throw an exception if upper.getField() is NULL and lower is something
> > else,
> > which is wrong, an exception should be thrown, since the field names are
> > different.
> >
> > most possible it should be
> >
> >    if(upperBound.getField() == null
> >       ||
> >       (upperBound.getField() != lowerBound.getField()
> >        && !upperBound.getField().equals(
> >            lowerBound.getField()))) {
> >      throw new IllegalArgumentException(
> >      ...
> >
> >
> > Am I missing something?
> >
> > Best Regards,
> > Adriano Crestani
> >
> >
> > On Sun, May 8, 2011 at 1:00 PM, <ka...@gmx.de>
> > wrote:
> >
> > > Hi Michael Busch,
> > >
> > > The Class ParametricRangeQueryNode was inserted in svn with LUCENE-1567
> > > "New flexible query parser".
> > >
> > > The constructor
> > >  public ParametricRangeQueryNode(ParametricQueryNode lowerBound,
> > >      ParametricQueryNode upperBound) {
> > > has a constraint about his parameters:
> > >
> > >    if (upperBound.getField() != lowerBound.getField()
> > >        || (upperBound.getField() != null &&
> > !upperBound.getField().equals(
> > >            lowerBound.getField()))) {
> > >      throw new IllegalArgumentException(
> > >      ...
> > >
> > > most possible it should be
> > >
> > >    if(upperBound.getField() == null
> > >       ||
> > >       (upperBound.getField() != lowerBound.getField()
> > >        && !upperBound.getField().equals(
> > >            lowerBound.getField()))) {
> > >      throw new IllegalArgumentException(
> > >      ...
> > > (
> > >  because
> > >  (upperBound == lowerBound
> > >  &&
> > >  !upperBound.getField().equals(lowerBound.getField()))
> > >  is a contradiction)
> > > )
> > >
> > > Best regards
> > >
> > >  Karsten
> > >
> > >
> > > P.S. currently I am working with SpanQueries in the queryparser-module,
> > so
> > > I wrote e.g. SpanNearQueryNode. Is this work already down by someone
> > else?
> > >
>