lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <>
Subject Re: "Field Grouping" query restrained to same field on a 'multi'-field'
Date Thu, 10 Aug 2006 20:34:04 GMT
Another thought is to index each paragraph as a separate document,  
though you'd of course have to see how that fits with your other  
searching needs.


On Aug 8, 2006, at 12:25 PM, Laurent Hoss wrote:

> Hi
> Suppose having an Index containing Lucene documents, having  
> multiple fields (equally) named 'paragraph'.
> Now I want to make a "Field Grouping" query (described in: http:// 
> )
> "paragraph:( word1 AND word2 )"
> retrieving only documents where the terms word1,word2 appear in the  
> SAME 'paragraph' Field (and not word1 in one 'paragraph' field, and  
> word2 possibly in another 'paragraph' field in this doc).
>      AFAIK right now this query is equivalent to query
> "paragraph:word1 AND paragraph:word2", which makes sense of course.
> Therefor to enable the behaviour I'm looking for, I'm thinking  
> about modifying the QueryParser to support some syntactic flag like  
> '#' in:  paragraph#:( word1 AND word2 ).
> This should generally work for  a query : paragraph#: 
> ( $subquery ) , where $subquery would be restrained to the same  
> 'paragraph' field as explained above.
> However the main question is whether adding such an option would be  
> feasible in Lucene (Core, Searcher?)
> without incrementing algorithmic complexity ... and is not too  
> complicated to implement?
> If yes I would be very happy to get some pointers in the right  
> direction, like in which Classes this is done best.
>  Thanks,
> Laurent
>  PS: If this is not an option, we (unhappily) would have to live  
> with following 'hack':
> Each 'paragraph' is stored in a differently named field (by adding  
> number) : paragraph1, paragraph2...
> Other than the uglyness, this would have the big drawback that we  
> need as many OR clauses as we set our maximum number of paragraphs  
> to .
> Simple,short query:
> paragraph: $query would have to be  exploded to:    (paragraph1:  
> $query) OR (paragraph2: $query)  OR ... OR (paragraphN: $query)
> PS2: Just saw following in the FAQ :
> "How can I search over multiple fields? "
> >Parse your query using MultiFieldQueryParser <http:// 
> MultiFieldQueryParser.html>. ...
> queryParser/MultiFieldQueryParser.html
> But this seems to not help here, or did I overlook something ?
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message