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.
Erik
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://
lucene.apache.org/java/docs/queryparsersyntax.html )
"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://
lucene.apache.org/java/docs/api/org/apache/lucene/queryParser/
MultiFieldQueryParser.html>. ...
http://lucene.apache.org/java/docs/api/org/apache/lucene/
queryParser/MultiFieldQueryParser.html
But this seems to not help here, or did I overlook something ?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]