Lucene: how to get the score of a document

前端 未结 3 1960
太阳男子
太阳男子 2020-12-31 22:41

I want to output the score of documents. The code I write for this is that:

IndexReader reader = IndexReader.open(FSDirectory.open(indexDir));
IndexSearcher          


        
3条回答
  •  萌比男神i
    2020-12-31 22:57

    additional to daulets answere you have to enable the scoring in the indexSearcher:

    ...
    searcher.setDefaultFieldSortScoring(true, true);
    ...
    

    I think thats what you meant remy, but that way it should be clearer :)

提交回复
热议问题