0

以下を含む 2 つのドキュメントがあります。

doc_1 :one two three four five Bingo

doc_2 :Bingo one two three four five

それぞれ 2 つのフィールドでインデックスを作成しています。1 つのフィールドには最初の 5 つの用語が含まれ、2 つ目のフィールドには最後の用語が含まれています。

TextField start_field = new TextField("start_words", content.substring(0, index), Field.Store.NO);
TextField end_field = new TextField("end_words", content.substring(index,content.length()-1, Field.Store.NO);
// index is index value of 5th ' '

ブースティングの結果をよりよく確認するために、次の類似性を実装しました。

DefaultSimilarity customSimilarity = new DefaultSimilarity() {
     @Override
     public float lengthNorm(FieldInvertState state) {
         return 1; // So length of each field would not matter
     }
};

ブーストを適用せずにBingo、同じスコアを持つ両方のドキュメントの結果を検索します (予想どおり、意図したとおり)。ただし、フィールド ( ) の 1 つにブーストを適用すると、 doc_2のフィールドを含むフィールドがブーストされstart_field.setBoost(5)ても、両方のスコアは同じままです。Bingo

を削除するとcustomSimilarity、ブーストは期待どおりに機能します。

boostingが停止する理由lengthNormと、指定された上書きされた類似度でブースティングを機能させるにはどうすればよいですか?

4

1 に答える 1