如何過濾以字符串開頭的字段? 現在我正在獲取所有文檔,其中字段包含以此字符串開頭的單詞。最好的結果是,如果有人回答如何確切地從結果開始,然後保持,如最接近過濾器的排序。謝謝。
像:Solr 6.4.2,使用startswith字符串過濾文檔
company_name:(max*) result : ['Min & Max', 'Maximum speed', 'Mirana max parrot']
但我想它想:
company_name:(max*) result : ['Maximum speed', 'Min & Max', 'Mirana max parrot']
現在我有這個配置對於文本字段:
<fieldType name="text_en" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_en.txt" />
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EnglishPossessiveFilterFactory"/>
<filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
<filter class="solr.EdgeNGramFilterFactory" minGramSize="3" maxGramSize="15" />
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="lang/stopwords_en.txt"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EnglishPossessiveFilterFactory"/>
<filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
<filter class="solr.EnglishMinimalStemFilterFactory"/>
<filter class="solr.EdgeNGramFilterFactory" minGramSize="3" maxGramSize="15" />
<filter class="solr.PorterStemFilterFactory"/>
</analyzer>
</fieldType>