Facet 字段值 return 多次使用 anagram 的相同值

Facet field value return same value multiple time with anagram

我正在尝试从 solr 获取字段的唯一值。我已经使用 facet 来获取字段值。我的方面查询参数看起来像-

        SolrQuery query = new SolrQuery();
        query.setQuery("*:*");
        query.setFacet(true);
        query.addFacetField("division");

我正在使用-

打印构面值
resp = solrClient.query(query);

            List<FacetField> fflist = resp.getFacetFields();
            for(FacetField ff : fflist){
                String ffname = ff.getName();

                int ffcount = ff.getValueCount();

                System.out.println(ffname+" "+ffcount);
                List<Count> counts = ff.getValues();
                for(Count c : counts){
                    String facetLabel = c.getName();
                    long facetCount = c.getCount();

                    System.out.println("facetlabel-->"+facetLabel+" facetcount-->"+facetCount);
                }
            }

我收到以下回复-

facetlabel-->seirossecca facetcount-->184
facetlabel-->accessori facetcount-->184
facetlabel-->seirossecca facetcount-->184
facetlabel-->cinht facetcount-->116
facetlabel-->cinht facetcount-->116
facetlabel-->ethnic facetcount-->116
facetlabel-->spot facetcount-->851
facetlabel-->spot facetcount-->851
facetlabel-->top facetcount-->851
facetlabel-->raewtoof facetcount-->577
facetlabel-->footwear facetcount-->577
facetlabel-->raewtoof facetcount-->577
facetlabel-->smottob facetcount-->387602
facetlabel-->bottom facetcount-->387602
facetlabel-->smottob facetcount-->387602
facetlabel-->ytuaeb facetcount-->354158
facetlabel-->beauti facetcount-->354158
facetlabel-->ytuaeb facetcount-->354158
facetlabel-->scinortcel facetcount-->204244
facetlabel-->electron facetcount-->204244
facetlabel-->scinortcel facetcount-->204244
facetlabel-->sesserd facetcount-->161
facetlabel-->dress facetcount-->161
facetlabel-->sesserd facetcount-->161

如您所见,我得到的是带有单独条目的分面字段的变位词,但相应的字段值相同。除法是类型-

text_search

schema.xml 中的文本搜索定义属于-

<fieldType name="text_search" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true" multiValued="true">
        <analyzer type="index">
          <tokenizer class="solr.WhitespaceTokenizerFactory"/>
          <filter class="solr.LowerCaseFilterFactory"/>
          <filter class="solr.ReversedWildcardFilterFactory"/>
          <filter class="solr.PorterStemFilterFactory"/>
          <filter class="solr.WordDelimiterFilterFactory" splitOnNumerics="0" generateWordParts="1" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="1" splitOnCaseChange="0" preserveOriginal="1"/>
          <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
        </analyzer>
        <analyzer type="query">
          <tokenizer class="solr.WhitespaceTokenizerFactory"/>
          <filter class="solr.LowerCaseFilterFactory"/>
          <filter class="solr.PorterStemFilterFactory"/>
          <filter class="solr.ReversedWildcardFilterFactory"/>
          <filter class="solr.WordDelimiterFilterFactory" splitOnNumerics="0" generateWordParts="1" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="1" splitOnCaseChange="0" preserveOriginal="1"/>
          <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
        </analyzer>
    </fieldType>

这是因为您正在使用 ReversedWildcardFilterFactory

ReversedWildcardFilterFactory : 反转标记的过滤器。

你也一样..

seirosseccaaccessories 相反 并且 accessories 缩短为 accessori 因为 PorterStemFilterFactory 因为它从单词中删除了常见的结尾。

为避免这种情况,您可以从 schema.xml.

中删除 ReversedWildcardFilterFactory
PorterStemFilterFactory :

如果想要从单词中删除常见的结尾,就留给你了。