【发布时间】:2012-01-16 15:44:13
【问题描述】:
我正在使用 solr 3.5 并添加了一个自定义字段,该字段通过在 schema.xml 中定义以下内容将类别添加到文档中。
<field name="category" type="string" indexed="true" stored="true"/>
现在我正在实现一个 Search-Web-Client,它应该显示该类别字段索引的所有值。我通过以下查询做到了:
facet=true&facet.field=category&q=*
结果如下:
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">45</int>
<lst name="params">
<str name="facet.field">category</str>
<str name="q">*</str>
<str name="facet">true</str>
</lst>
</lst>
<result name="response" numFound="0" start="0" maxScore="0.0"/>
<lst name="facet_counts">
<lst name="facet_queries"/>
<lst name="facet_fields">
<lst name="category">
<int name="category1">0</int>
<int name="category2">0</int>
<int name="category3">0</int>
<int name="category4">0</int>
<int name="category5">0</int>
</lst>
</lst>
<lst name="facet_dates"/>
<lst name="facet_ranges"/>
</lst>
</response>
My Web-Client 显示所有类别的名称,但它们是小写的,但以大写字母存储在索引中。
<response>
<result>
<doc>
...
<str name="category">Category1</str>
...
</doc>
</result>
</response>
- 解决方案 a:是否可以强制 facet-values 名称区分大小写?
- 解决方案 b:是否有另一个查询可以提供存储在索引中的每个类别值?
【问题讨论】:
-
您能否在
schema.xml中发布您的字符串字段类型的定义?这不是默认的,对吧? -
感谢您的帮助,这是默认定义。但我需要重新索引我的网站。
标签: solr full-text-search faceted-search