You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Daniel Naber <da...@t-online.de> on 2004/11/13 13:46:05 UTC
the future of MultiFieldQueryParser
Hi,
I'd like to fix MultiFieldQueryParser so that it properly works with AND
queries. Currently it rewrites AND queries so that all terms must appear
in all fields, which rarely makes sense.
Eric Jain suggested a new class that works for AND and OR queries:
http://issues.apache.org/eyebrowse/ReadMsg?listName=lucene-user@jakarta.apache.org&msgId=1798116
It seems that his code can just be added to the current
MultiFieldQueryParser class. The current static calls can then all be
deprecated (once some feature like setting required/prohibited per field
have been added to the new code).
Does anybody see a problem with that?
Regards
Daniel
--
http://www.danielnaber.de
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
Re: the future of MultiFieldQueryParser
Posted by Daniel Naber <da...@t-online.de>.
On Monday 15 November 2004 20:00, Christiaan Fluit wrote:
> I'm not sure whether we are thinking alike here. Judging from the code
> in 1.4.2, I expect the query "X AND Y" to be evaluated as:
>
> (field1:X AND field1:Y) OR (field2:X AND field2:Y) OR ... (fieldn:X AND
> fieldn:Y)
Yes, that's the way Lucene currently behaves.
> is somewhat counter-intuitive. When I enter this query, I would except
> it to be evaluated as:
>
> (field1:X OR field2:X OR ... fieldn:X) AND (field1:Y OR field2:Y OR ...
> fieldn:Y)
That's what the new implementation will return. For OR queries it shouldn't
make a difference, so the new implementation can replace the old one.
Regards
Daniel
--
http://www.danielnaber.de
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
Re: the future of MultiFieldQueryParser
Posted by Christiaan Fluit <ch...@aduna.biz>.
Daniel Naber wrote:
> On Monday 15 November 2004 09:50, Christiaan Fluit wrote:
>>Is it correct that Lucene 1.4.2 already had the desired behaviour? It's
>>parse method looks like this (MFQP revision 1.4):
>
> That version doesn't work as expected for queries where all the terms are
> required, it parses them in a way so that every term needs to be in every
> field.
I'm not sure whether we are thinking alike here. Judging from the code
in 1.4.2, I expect the query "X AND Y" to be evaluated as:
(field1:X AND field1:Y) OR (field2:X AND field2:Y) OR ... (fieldn:X AND
fieldn:Y)
Is my interpretation of the code correct? If so, then I agree that this
is somewhat counter-intuitive. When I enter this query, I would except
it to be evaluated as:
(field1:X OR field2:X OR ... fieldn:X) AND (field1:Y OR field2:Y OR ...
fieldn:Y)
In other words: both terms have to appear in at least one field of the
document and this does not necessarily have to be the same field. This
way it doesn't matter whether the indexer uses one field or several
fields to index his contents. Would your change result into this behaviour?
Regards,
Chris
--
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
Re: the future of MultiFieldQueryParser
Posted by Daniel Naber <da...@t-online.de>.
On Monday 15 November 2004 09:50, Christiaan Fluit wrote:
> Is it correct that Lucene 1.4.2 already had the desired behaviour? It's
> parse method looks like this (MFQP revision 1.4):
That version doesn't work as expected for queries where all the terms are
required, it parses them in a way so that every term needs to be in every
field.
Regards
Daniel
--
http://www.danielnaber.de
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
Re: the future of MultiFieldQueryParser
Posted by Christiaan Fluit <ch...@aduna.biz>.
Is it correct that Lucene 1.4.2 already had the desired behaviour? It's
parse method looks like this (MFQP revision 1.4):
public static Query parse(String query, String[] fields, Analyzer
analyzer)
throws ParseException
{
BooleanQuery bQuery = new BooleanQuery();
for (int i = 0; i < fields.length; i++)
{
Query q = parse(query, fields[i], analyzer);
bQuery.add(q, false, false);
}
return bQuery;
}
Chris
--
Otis Gospodnetic wrote:
> I would like that change, as I don't always like queries that MFQP
> creates.
>
> Otis
>
> --- Daniel Naber <da...@t-online.de> wrote:
>
>
>>Hi,
>>
>>I'd like to fix MultiFieldQueryParser so that it properly works with
>>AND
>>queries. Currently it rewrites AND queries so that all terms must
>>appear
>>in all fields, which rarely makes sense.
>>
>>Eric Jain suggested a new class that works for AND and OR queries:
>>
>
> http://issues.apache.org/eyebrowse/ReadMsg?listName=lucene-user@jakarta.apache.org&msgId=1798116
>
>>It seems that his code can just be added to the current
>>MultiFieldQueryParser class. The current static calls can then all be
>>
>>deprecated (once some feature like setting required/prohibited per
>>field
>>have been added to the new code).
>>
>>Does anybody see a problem with that?
>>
>>Regards
>> Daniel
>>
>>--
>>http://www.danielnaber.de
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
>
--
christiaan.fluit@aduna.biz
Aduna
Prinses Julianaplein 14-b
3817 CS Amersfoort
The Netherlands
+31 33 465 9987 phone
+31 33 465 9987 fax
http://aduna.biz
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
Re: the future of MultiFieldQueryParser
Posted by Otis Gospodnetic <ot...@yahoo.com>.
I would like that change, as I don't always like queries that MFQP
creates.
Otis
--- Daniel Naber <da...@t-online.de> wrote:
> Hi,
>
> I'd like to fix MultiFieldQueryParser so that it properly works with
> AND
> queries. Currently it rewrites AND queries so that all terms must
> appear
> in all fields, which rarely makes sense.
>
> Eric Jain suggested a new class that works for AND and OR queries:
>
http://issues.apache.org/eyebrowse/ReadMsg?listName=lucene-user@jakarta.apache.org&msgId=1798116
>
> It seems that his code can just be added to the current
> MultiFieldQueryParser class. The current static calls can then all be
>
> deprecated (once some feature like setting required/prohibited per
> field
> have been added to the new code).
>
> Does anybody see a problem with that?
>
> Regards
> Daniel
>
> --
> http://www.danielnaber.de
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org