You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lucenenet.apache.org by nima dilmaghani <ni...@gmail.com> on 2011/10/12 01:10:53 UTC
[Lucene.Net] when indexing I boost certain documents, but their score at search is
still 1
I am trying to boost certain documents. But they don't get boosted. Please
tell me what I am missing. Thanks!
In my index code I have:
if (myCondition)
{
myDocument.SetBoost(1.1f);
}
myIndexWriter.AddDocument(document);
then in my search code I retrieve the collection of documents from the
ScoreDocs object into myDocuments collection and:
foreach (Lucene.Net.Documents.Document doc in myDocuments)
{
float tempboost = doc.GetBoost();
}
and I place a breakpoint in the foreach clause to break if the tempboost is
not 1. and the breakpoint is never hit.
What did I miss?
Many thanks!
Re: [Lucene.Net] when indexing I boost certain documents, but their
score at search is still 1
Posted by Robert Jordan <ro...@gmx.net>.
On 12.10.2011 01:10, nima dilmaghani wrote:
> I am trying to boost certain documents. But they don't get boosted. Please
> tell me what I am missing. Thanks!
>
> In my index code I have:
>
> if (myCondition)
> {
> myDocument.SetBoost(1.1f);
> }
> myIndexWriter.AddDocument(document);
>
> then in my search code I retrieve the collection of documents from the
> ScoreDocs object into myDocuments collection and:
>
> foreach (Lucene.Net.Documents.Document doc in myDocuments)
> {
> float tempboost = doc.GetBoost();
> }
>
> and I place a breakpoint in the foreach clause to break if the tempboost is
> not 1. and the breakpoint is never hit.
>
> What did I miss?
You missed to read the documentation:
http://lucene.apache.org/java/3_0_2/api/core/org/apache/lucene/document/Document.html#getBoost%28%29
Robert