簡體   English   中英

SOLR facet帶有前綴和過濾器

[英]SOLR facet with prefix and filters

我有使用facet的問題。

我需要自動完成,為此我使用facet:

http://localhost:8080/solr/select?q=*:*&wt=json&indent=on&facet=on&rows=0&fq=filter:("30")  AND filter2:("1")&facet.field=spell&facet.prefix=g&facet.limit=10&facet.mincount=1

我正在使用facet,因為我需要添加過濾器來查詢例如filter:(“30”)AND filter2 :(“1”)

當我在索引中有一些文檔都工作得很好而且速度很快但是如果我在索引中添加了很多文檔,這個查詢工作太慢或者只是SOLR在這個查詢中沒有響應。

我的schema.xml:

......
<fieldType name="textSpellShingle" class="solr.TextField" positionIncrementGap="100">
   <analyzer>
      <tokenizer class="solr.StandardTokenizerFactory"/>
      <filter class="solr.LowerCaseFilterFactory"/>
      <filter class="solr.ShingleFilterFactory" maxShingleSize="4" outputUnigrams="true"/>
      <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
   </analyzer>
</fieldType>
.....
<fields>
   <field name="id" type="string" indexed="true" stored="true" required="true"/>
   <field name="article" type="textSpellShingle" indexed="true" stored="false" multiValued="true"/>
   <field name="title" type="text_general" indexed="true" stored="true"/>
   <field name="filter" type="int" indexed="true" stored="true"/>
   <field name="filter2" type="int" indexed="true" stored="true"/>
</fields>
<uniqueKey>id</uniqueKey>
<defaultSearchField>article</defaultSearchField>
<solrQueryParser defaultOperator="OR"/>
<copyField source="article" dest="spell"/>
<copyField source="title" dest="spell"/>
....

我發現問題我只是添加了facet.method = enum,現在它工作正常。 我還刪除了fq = filter :(“30”)AND filter2 :(“1”)並將其放在查詢中,所以...查詢現在看起來像這樣:

http://localhost:8080/solr/select?q=filter:("30") AND filter2:("1")&wt=json&indent=on&facet=on&rows=0&facet.field=spell&facet.prefix=g&facet.limit=10&facet.mincount=1&facet.method=enum

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM