I'm a bit confused by the Lucene.NET API, but, it may just be a misunderstanding on my part as I'm still learning.
When you create a document, you add fields to that document. An example:
//Create the field.
field = new Field(
fieldName,
fieldValue,
isFieldStorable ? Field.Store.YES : Field.Store.NO,
Field.Index.ANALYZED
);
//If a boost value was supplied, then set the boost for this field.
if (boostValue != null) {
field.SetBoost((float)boostValue);
}
This correctly sets the boost on the field. The field is then added to a document, and the document is added to the index writer.
But, it doesn't look like setting the boost on the field really matters. How does that ever make a difference? Because, when I create my query, I need to call something like:
multiFieldQueryParser = new MultiFieldQueryParser(
Lucene.Net.Util.Version.LUCENE_29,
fieldsToSearch.ToArray(),
analyzer
);
Creating an instance of MultiFieldQueryParser allows me to supply a dictionary of boosts, but, then what's the point of setting the boost on the field? The query parser doesn't know anything about my documents and the fields contained within them (and as a result, doesn't know anything about my field boosting).
Is this just a mistake of perhaps old code being left in the library? Or can setting the boost on the field actually make a difference if you have your code structured differently?