0

検索するsolrクエリがあります(webpage_text:*test* OR company_text:*test*)

強調表示で、フィールドを に設定しましたwebpage_text, company_text。しかし、検索語が webpage_text でしか見つからない場合でも、強調表示の結果で常に両方のフィールドを取得します。完全なフィールドである company_text の強調表示の結果も取得します。

一致したフィールドのハイライトのみを返すことはできますか?

requireFieldMatch を試しましたが、うまくいきません。

@EDIT: 重要な情報かもしれません: 2 つのフィールドは、実際にはコピー フィールドで埋められた空のフィールドです。これは影響がありますか?

<field name="company_text" type="text_general" indexed="true" stored="true" multiValued="true" default="" termVectors="true" termPositions="true" termOffsets="true"/>
<field name="webpage_text" type="text_general" indexed="true" stored="true" multiValued="true" default="" termVectors="true" termPositions="true" termOffsets="true"/>

<dynamicField name="*company_*" type="string" indexed="true" stored="true" multiValued="true"/>
<dynamicField name="*talent_*" type="string" indexed="true" stored="true" multiValued="true"/>

<copyField source="company_*" dest="company_text" maxLength="30000000"/>
<copyField source="webpage_*" dest="webpage_text" maxLength="30000000"/>

@EDIT2: 一致するものがない場合でも、常にコピーフィールドが強調表示されているように見えます。

4

2 に答える 2

0

オプションrequireFieldMatchはあなたが使用する必要があるものだと思います。ただし、これを機能さusePhraseHighlighterせるには、用語を引用符で囲んでPhraseQueriesを有効にしてから、実行していることを確認する必要があります。(例webpage_text:"*test*"

したがって、例は次のようになります。

http://localhost:8983/solr/select/q=webpage_text%3A"*test*"+OR
  +company_text%3A"*test*"&wt=xml&hl=true&hl.fl=webpage_text%2Ccompany_text
  &hl.simple.pre=<em>&hl.simple.post=<%2Fem>
  &hl.requireFieldMatch=true&hl.usePhraseHighlighter=true

必要に応じてサーバー設定とシナリオの追加パラメーターを調整する必要があります。

于 2012-12-13T20:54:42.450 に答える
0

特に指定がない限り、Solr は常にすべてのフィールドを返します。フィールドが検索クエリに含まれているかどうかは問題ではありません。一致するフィールドが強調表示されます。

フィールドが 2 つしかない場合、これらの 2 つまたはすべてのフィールドが返され、そのうちの 1 つが強調表示されます。

于 2012-12-14T09:50:02.760 に答える