Hello everybody,
I have a search app in which the user can specify in which category the
documents he's searching are. So all my indexed documents have a
"category" field as well as other fields such as title, description,
etc. So when the user enters his query, only the documents that are in
the
I think query.toString() is your friend here. I'm having a hard
time figuring out, from your description, what you actually want,
so maybe some examples would help too.
If your users enter terms for each field, then it seems to me that
you'd want MUST between clauses (in which case MultiFieldQuery
What I wanted to do was to set at least one "SHOULD" field as required in a
MFQP. Because of the MUST field I had, even if no SHOULD field matched the
query, all the documents which had the corresponding MUST field were
returned. I found a very easy solution to solve my problem ::
BooleanQuery myQ