1

solrを使用してクエリを実行するために、アーカイブされたWebサイトのコレクションにインデックスを付けました。一意のキーとして、サイトのURLを使用します。私がやりたいのは、フィルタークエリでurlフィールドを使用して、必要に応じて検索を特定のドメインに制限することです。たとえば、「Barack Obama」をクエリしたいのですが、結果を「whitehouse.gov」ドメインに制限します。私にはかなり基本的なユースケースのように聞こえますが、URLフィールドで検索しても結果はまったく返されません。これが私の設定(schema.xml)です:

 .
 .
 .
 <field name="collection" type="string" indexed="true" stored="true"/>
 <field name="content" type="text_de" indexed="true" stored="true" multiValued="true"/>
 <field name="date" type="string" indexed="true" stored="true"/>
 <field name="digest" type="string" indexed="true" stored="true"/>
 <field name="length" type="string" indexed="true" stored="true"/>
 <field name="segment" type="string" indexed="true" stored="true"/>
 <field name="site" type="string" indexed="true" stored="true"/>
 <field name="title" type="text_de" indexed="true" stored="true" multiValued="true"/>
 <field name="type" type="string" indexed="true" stored="true"/>
 <field name="url" type="text_en_splitting" indexed="true" stored="true"/>
 .
 .
 .

<!-- Field to use to determine and enforce document uniqueness. 
  Unless this field is marked with required="false", it will be a required field
-->
 <uniqueKey>url</uniqueKey>

そして、これが私のクエリです(簡略化):

http://mysolrserver.com:8983/solr/select/?q=content:Barack+Obama&fq=url:whitehouse.gov

クエリアナライザは、クエリが一致する必要があることを通知します。

スクリーンショットsolr分析

なぜこれが機能しないのか誰かが知っていますか?私が得ることができるどんなヒントにも非常に感謝します!たくさんの人に感謝します!

4

1 に答える 1

2

fq=url:whitehouse.govフィルタリングが機能するはずです。

ただし、クエリに問題がありますq=content:Barack+Obama
デフォルトの検索フィールドは??
クエリ コンポーネントを削除し、q=*:*結果を返します。??

q=content:Barack+Obamaクエリは、実際には次のようなクエリになりcontent:barack defaultsearchfield:obama
ます。デフォルトの検索フィールドにはオバマが含まれていないため、結果は得られません。

于 2012-09-11T11:56:36.417 に答える