lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject Re: Boost problems
Date Wed, 17 May 2006 19:54:34 GMT
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 <marcus.falck@observer.se>
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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message