Set a field as required in a MultiFieldQueryParser

2009-02-01 Thread Sylvain
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

Re: Set a field as required in a MultiFieldQueryParser

2009-02-01 Thread Erick Erickson
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

Re: Set a field as required in a MultiFieldQueryParser

2009-02-03 Thread Sylvain
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