Hello,

I have a problem with the BOOST DOCUMENT method.

When I have 2 documents that have exactly the same data, but different boost
value.
The order does not respect the boost value. It the following exemples, the
first document of the search is the document with the lower boost value...
is it a bug ?

Here is my test code:

public void testIt() throws IOException, ParseException
        {
                RAMDirectory ramDir = new RAMDirectory();
                IndexWriter writer = new IndexWriter(ramDir, new 
StandardAnalyzer(),
true);
                
                Document doc1 = new Document();
                Field word = new Field("WORD","home",
Field.Store.YES,Field.Index.TOKENIZED);
                word.setBoost(15);
                doc1.add(word);
                Field id = new Field("ID","111", 
Field.Store.YES,Field.Index.NO);
                doc1.add(id);
                doc1.setBoost(3163);
                
                Document doc2 = new Document();
                word = new Field("WORD","home", 
Field.Store.YES,Field.Index.TOKENIZED);
                word.setBoost(15);
                doc2.add(word);
                id = new Field("ID","222", Field.Store.YES,Field.Index.NO);
                doc2.add(id);
                doc2.setBoost(3150);
                
                
                writer.addDocument(doc2);
                writer.addDocument(doc1);
                
                writer.optimize();
                writer.close();
                
                Searcher searcher = new IndexSearcher(ramDir);
                
                QueryParser queryParserWord = new QueryParser("WORD",new
StandardAnalyzer());
                Query query = queryParserWord.parse("home");
                
                Hits hits = searcher.search(query);
                
                for (int i = 0; i < hits.length(); i++) {
                        System.out.println("----- DOC " + hits.doc(i).get("ID") 
+"-----" +
hits.doc(i).get("WORD")+"-");
                        
System.out.println(searcher.explain(query,hits.id(i)).toString());
                }
        }


Thanks a lot !
-- 
View this message in context: 
http://www.nabble.com/Boost-Document-tf2654631.html#a7405959
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


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

Reply via email to