Reputation: 93297
I'm trying to incorporate Lucene.net in my web search.
Currently I have a lucene.net index that contains +1 million documents with 7 fields each. The last field is the "all" field that has the content of the previous fields concatenated. Searching the all field is just EXTREMELY fast :)
But I feel there is more to be found here. How can I make a search that searches one or more space separated strings over all the fields without using the "all" field?
I want to be able to give weights to certain fields. Furthermore it would be really nice if the search contained information on WHERE the hit took place so I can show it in the result.
I think this is all possible, but I don't immideatelly see how.
Any help?
Upvotes: 6
Views: 1164
Reputation: 3941
I don't think you need to maintain an "all" field.
Good luck
Upvotes: 3
Reputation: 25856
We do something similar, the trick is to specify fields in your query string:
(+Tier1:ribbon^1)^4 OR (+Tier2:ribbon^1)^4 OR (+Tier3:ribbon^1) OR (+Tier4:q*ribbon*^1)^12
In the above example, the user searched for "ribbon" in our application. We have different segments of data in different fields, and the final field "Tier4" contains all the previous terms concatenated together. We prepend the field with a "q", so we can do leading wild-cards, also:
(+Tier4:q*ribbon*^1)^12
Lastly, we use boosts with the caret (^). This ends up weighting things differently. It took a while to get boosts right, and I'm still not 100% happy with them, but they do make a big impact.
Upvotes: 4
Reputation: 115691
You have to get Lucene in Action. Although about original (that is Java) Lucene implementation, it contains all the information you need: about boosts, highlighters, qwery parsers, etc.
Upvotes: 1