I see you already got 2 answers.  However, judging from your source, it looks 
like you are really using the .Net port of Lucene, so a better place to ask 
would be the lucene.net mailing list.

Otis

----- Original Message ----
From: Marcus Falck <[EMAIL PROTECTED]>
To: java-user@lucene.apache.org
Sent: Wednesday, May 17, 2006 9:43:51 AM
Subject: Boost problems

Hello,

 

I have run in to problems regarding boosting of documents, using
lucene.net 1.4.3 (so if anybody runs the java version and feel for
running my posted source code please do so and see if the result is the
same).

 

The following code:

       // The following example illustrates the boost problematic

       Document doc = new Document();

       doc.Add(Field.Text("BodyText", "My name is Marcus"));

       doc.SetBoost(2); // <-- Set the boost to 2

 

       // Create index

IndexWriter iw = new IndexWriter(@"c:\ixtest", new StandardAnalyzer(),
true);

       iw.AddDocument(doc);

       iw.Optimize();

       iw.Close();

 

       // Search

       Searcher s = new IndexSearcher(@"c:\ixtest");

       Query q = QueryParser.Parse("BodyText:name",null, new
StandardAnalyzer());

       

       Hits h = s.Search(q);

       Console.WriteLine( h.Doc(0).GetField("BodyText").StringValue() );

       Console.WriteLine( h.Doc(0).GetBoost());

       s.Close();

 

Outputs:

My name is Marcus

1

 

Why does it reply with 1 as boost? Shouldn't this value be 2?

 

/

Regards 

Marcus 

 





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to