This question is a spin-off from this question. My inquiry is two-fold, but because both are related I think it is a good idea to put them together.
--EDIT--
I'll give a requirement example for a query I would like to make:
Say I have 5 fields:
All fields are optional, the last field should search over all the other fields.
I go over every field and see if it's IsNullOrEmpty(). If it's not, I would like to append a part of my query so it adds the relevant search part.
First name and last name should be exact matches and have more weight then the other fields. Age is a string and should exact match. Address can varry in order. Everything can also varry in order.
How should I go about this?
Use the BooleanQuery class to compose query objects. Create one of these and add() other Query objects to it to create a larger, disjunctive query:
Atomic queries can be built with the Term and TermQuery classes.
(Links and example are for Lucene Java, but .NET should be similar.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With