solr-solr参数,配置

1.常见的查询参数:
  • q:查询参数,例如q=*:*
  • sort:排序,sort=id asc
  • start,rows:分页,start默认值0,起始位置;rows返回记录数,默认值0
  • fq:Filter Query中用到,会还存到filterCache中,fq=section:0
  • fl:指定要显示的字段,默认显示全部字段,fl=id name price

2.solr配置文件:
schema.xml
<fieldType name="text_general_rev" class="solr.TextField" positionIncrementGap="100">
      <analyzer type="index"><!--索引时分词-->
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.ReversedWildcardFilterFactory" withOriginal="true"
           maxPosAsterisk="3" maxPosQuestion="2" maxFractionAsterisk="0.33"/>
      </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="stopwords.txt" enablePositionIncrements="true" />
        <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
    </fieldType>

字段:
   <field name="id" type="text_general" indexed="true" stored="true"/>
   <field name="description" type="text_general" indexed="true" stored="true"/>
   <field name="comments" type="text_general" indexed="true" stored="true"/>
   <field name="author" type="text_general" indexed="true" stored="true"/>
   <field name="keywords" type="text_general" indexed="true" stored="true"/>
   <field name="category" type="text_general" indexed="true" stored="true"/>
<uniqueKey>id</uniqueKey><!--主键-->

猜你喜欢

转载自baibashige.iteye.com/blog/1714078