Solr と Faceting に問題があり、誰かが修正を知っているかどうか疑問に思っています。現時点では回避策がありますが、クエリが機能しない理由を突き止めたいと思っています。
これが私のスキーマです。簡単に理解できるように簡略化されています。
<fields>
<field name="uniqueid" type="string" indexed="true" required="true"/>
<!-- Indexed and Stored Field --->
<field name="recordtype" type="text" indexed="true" stored="true"/>
<!-- Facet Version of fields -->
<field name="frecordtype" type="string" indexed="true" stored="false"/>
</fields>
<!-- Copy fields for facet searches -->
<copyField source="recordtype" dest="frecordtype"/>
ご覧のとおり、recordtype という大文字と小文字を区別しないフィールドがあり、テキストをトークン化しない大文字と小文字を区別するフィールド frecordtype にコピーされます。これは、solr がファセット結果に格納された値ではなく、インデックス付きの値を返すためです。
次のクエリを試すと:
http://localhost:8080
/solr
/select
?version=2.2
&facet.field=%7b!ex%3dfrecordtype%7dfrecordtype
&facet=on
&fq=%7b!tag%3dfrecordtype%7dfrecordtype%3aLarge%20Record
&f1=*%2cscore
&rows=20
&start=0
&qt=standard
&q=text%3a%25
結果は得られませんが、ファクテティングではまだ 1 つのレコードがあることが示されています。
<result name="response" numFound="0" start="0" />
<lst name="facet_counts">
<lst name="facet_queries" />
<lst name="facet_fields">
<lst name="frecordtype">
<int name="Large Record">1</int>
<int name="Small Record">12</int>
<int name="Other">1</int>
</lst>
</lst>
<lst name="facet_dates" />
</lst>
ただし、フィトラー クエリ (7 行目のみ) を frecordtype の代わりに "recordtype" に変更すると、次のようになります。
http://localhost:8080
/solr
/select
?version=2.2
&facet.field=%7b!ex%3dfrecordtype%7dfrecordtype
&facet=on
&fq=%7b!tag%3dfrecordtype%7drecordtype%3aLarge%20Record
&f1=*%2cscore
&rows=20
&start=0
&qt=standard
&q=text%3a%25
私が望む1つの結果が返されます。
<result name="response" numFound="1" start="0" />
<lst name="facet_counts">
<lst name="facet_queries" />
<lst name="facet_fields">
<lst name="frecordtype">
<int name="Large Record">1</int>
<int name="Small Record">12</int>
<int name="Other">1</int>
</lst>
</lst>
<lst name="facet_dates" />
</lst>
私の質問は、クエリの最初のバージョンを取得して必要な結果を返すために必要なことはありますか? URLエンコーディングとか関係あるのかな?一部のsolrの達人などからのヒントは非常にありがたいです。
注: ファセットは実際に機能しているため、これは必ずしもファセットに関する質問ではありません。大文字と小文字の区別と間隔はインデックス付きバージョンとまったく同じですが、「文字列」フィールドでクエリを実行できないという点で、クエリの質問です。
編集: ファセットの詳細については、次のブログ投稿をご覧ください。
- http://www.craftyfella.com/2010/01/faceting-and-multifaceting-syntax-in.html
- http://wiki.apache.org/solr/SimpleFacetParameters#facet.limit
ありがとう
デイブ