Search code examples
solrsolrnet

Best way to perform search on several fields‏


I have to perform search on several fields for ex.(ProductName,ProductDescription,FeedBackOfProduct etc.).

Currently I have 2 approaches 1. I will copy all these searchable fields into one copy field and perform search on that field. But problem here is How can I boost a perticular field say suppose only on ProductName.

2.Or I will search by field name and give boost accordingly. ProductName:"Test"^50.0 ProductDescription:"Easy To Handle"~100^70.0

Please tell me which will the best approach.

Thanks in advance.


Solution

  • With the 2nd option (search by field with boost) you have more control over how documents are scored, as you note you do not have this control with 1st option. Either way is a valid approach and which one you want to use will depend on your use case scenarios.