lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Boost problems
Date Wed, 17 May 2006 18:47:45 GMT

Document boosts are folded into the individual fieldNorms when the
document is indexed -- they are not accessible from the Document object
returned after doing search.  This is mentioned in the javadocs for
Document.getBoost ... at least it is in 1.9, I'm not sure about 1.4.



: Date: Wed, 17 May 2006 15:43:51 +0200
: From: Marcus Falck <marcus.falck@observer.se>
: Reply-To: java-user@lucene.apache.org
: To: java-user@lucene.apache.org
: 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
:
:
:
:



-Hoss


---------------------------------------------------------------------
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