You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Thomas Plümpe <th...@gmx.de> on 2004/07/18 18:39:15 UTC

Re: Query across multiple fields scenario not handled by "MultiFieldQueryParser"

Dear all,

I would like to do the exact same thing that Ali Rouhi posed as a
challenge in [*] and has found a solution for. Unfortunately I haven't
been able to get through to him. Does anybody here know which changes I
would have to make to QueryParser.jj to get the functionality described?

[*] http://issues.apache.org/eyebrowse/ReadMsg?listName=lucene-user@jakarta.apache.org&msgNo=4659

Thomas



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


Re: Query across multiple fields scenario not handled by "MultiFieldQueryParser"

Posted by Thomas Plümpe <th...@gmx.de>.
Daniel,

> > Does anybody here know which changes I
> > would have to make to QueryParser.jj to get the functionality described?
> 
> I haven't tried it but I guess you need to change the getXXXQuery() methods so 
> they return a BooleanQuery. For example, getFieldQuery currently might return 
> a TermQuery; you'll need to change that so it returns a BooleanQuery with two 
> TermQuerys. These two queries would have the same term, but a different 
> field.
> 
> Another approach is to leave QueryParser alone and modify the query after it 
> has been parsed by recursively iterating over the parsed query, replacing 
> e.g. TermQuerys with BooleanQuerys (just like described above).
many thanks for your advice. Although I was hoping not to have to
implement the change (as it has apparently been done), I guess this is
enough to get me going.

Thomas



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


Re: Query across multiple fields scenario not handled by "MultiFieldQueryParser"

Posted by Daniel Naber <da...@t-online.de>.
On Sunday 18 July 2004 18:39, Thomas Plümpe wrote:

> Does anybody here know which changes I
> would have to make to QueryParser.jj to get the functionality described?

I haven't tried it but I guess you need to change the getXXXQuery() methods so 
they return a BooleanQuery. For example, getFieldQuery currently might return 
a TermQuery; you'll need to change that so it returns a BooleanQuery with two 
TermQuerys. These two queries would have the same term, but a different 
field.

Another approach is to leave QueryParser alone and modify the query after it 
has been parsed by recursively iterating over the parsed query, replacing 
e.g. TermQuerys with BooleanQuerys (just like described above).

Regards
 Daniel


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