简体   繁体   English

如何使用solr facet查询在solr文本字段上获得可折叠的结果?

[英]How to get collapsible results on solr text fields using solr facet query?

I am generating a stats report from solr using facet queries. 我正在使用方面查询从solr生成统计报告。 When generating exception report , we grouped the exception using its class_name field in solr. 在生成异常报告时,我们使用solr中的class_name字段将异常分组。

schema.xml schema.xml

<field name="class_name" type="text" indexed="true" stored="false" compressed="false"/>

Solr Query Solr查询

http://ultrasound.zmedia.com/solr/goo/select/?q=exception&version=2.2&start=0&rows=0&indent=on&facet=true&facet.field=class_name

Solr Query Results Solr查询结果

    <response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">59</int>
</lst>
<result name="response" numFound="1068" start="0"/>
<lst name="facet_counts">
<lst name="facet_queries"/>
<lst name="facet_fields">
<lst name="class_name">
<int name="com">1068</int>
<int name="zmedia">1057</int>
<int name="pool">120</int>
<int name="processor">130</int>
<int name="server">53</int>
<int name="tldresult">43</int>
<int name="tomcat">20</int>
<int name="user">19</int>
<int name="util">19</int>
</lst>
</lst>
<lst name="facet_dates"/>
<lst name="facet_ranges"/>
</lst>
</response>

Expected Result 预期结果

    <response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">59</int>
</lst>
<result name="response" numFound="1068" start="0"/>
<lst name="facet_counts">
<lst name="facet_queries"/>
<lst name="facet_fields">
<lst name="class_name">
<int name="com.zmedia.tomcat">20</int>
<int name="com.zmedia.user.util">19</int
</lst>
</lst>
<lst name="facet_dates"/>
<lst name="facet_ranges"/>
</lst>
</response>

How can i do this?. 我怎样才能做到这一点?。 I cannot change the datatype , because it's running in production setup. 我无法更改数据类型,因为它正在生产设置中运行。

As the field is text and tokenized, the facets returned would be individual words instead of the Complete string. 由于该字段是文本并且已标记,因此返回的构面将是单个单词,而不是完整字符串。
There is no other option then to change the datatype or maintain a different field with string datatype and this would need change in Configuration and reindexing. 没有其他选择可以更改数据类型或使用字符串数据类型维护其他字段,这将需要在Configuration和reindexing中进行更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM