How to Boost a Field In Lucene.Net 3
asp.net-mvc-4, c#-4.0, lucene.net
Solution
You can boost a field in index time or in search time. To boost a field in index time you can set:
Field titleField = new Field("title", strTitle, Field.Store.NO, Field.Index.ANALYZED);
titleField.Boost = 2;
doc.Add(titleField);
remember that OmitNorms must be set to false.
To boost a field in search time you can set:
TermQuery q = new TermQuery(new Term("title", "cat"));
q.Boost = 2;
_searcher.Search(q, 100);
Problem
I want to boost a field in Lucene.Net 3.0.3. However the SetBoost Method doesnt appear to be defined anymore in Lucene. How do I boost a field, say, I want the "Title" of a document to carry more weight that the rest of the fields?