FAQ
I'm having some trouble retrieving data I need from a combined query.

Here's what I'm trying to do: I want to search on several fields of my
documents and then return the best hits. I'm doing something like this:
org.apache.lucene.search.Query bodyQuery =
QueryParser.parse(queryString.toLowerCase(), "body",
analyzer);

org.apache.lucene.search.Query subjectQuery =
QueryParser.parse(queryString.toLowerCase(), "subject",
analyzer);

org.apache.lucene.search.Query attachmentsQuery =
QueryParser.parse(queryString.toLowerCase(),
"attachmentsText", analyzer);

BooleanQuery bQuery = new BooleanQuery();
bQuery.add(subjectQuery,false,false);
bQuery.add(bodyQuery,false,false);
bQuery.add(attachmentsQuery, false, false);

Hits hits = searcher.search(comboQuery);

All well and good. But when I'm displaying the results, I want to know which
fields were responsible for the hit. It doesn't seem like this is something
that is available within in the hit. One option is to search again in all
hits for the field where this occurred. That doesn't seem efficient. Another
is to conduct several queries, but then merging the results becomes a little
problematic. Any recommendations of which way to go?

Jim


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

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedFeb 13, '03 at 5:09p
activeFeb 13, '03 at 5:09p
posts1
users1
websitelucene.apache.org

1 user in discussion

James Berrettini: 1 post

People

Translate

site design / logo © 2022 Grokbase