1.常见的查询参数:
[list]
[*]q:查询参数,例如q=*:*
[*]sort:排序,sort=id asc
[*]start,rows:分页,start默认值0,起始位置;rows返回记录数,默认值0
[*]fq:Filter Query中用到,会还存到filterCache中,fq=section:0
[*]fl:指定要显示的字段,默认显示全部字段,fl=id name price
[/list]
2.solr配置文件:
schema.xml
字段:
[list]
[*]q:查询参数,例如q=*:*
[*]sort:排序,sort=id asc
[*]start,rows:分页,start默认值0,起始位置;rows返回记录数,默认值0
[*]fq:Filter Query中用到,会还存到filterCache中,fq=section:0
[*]fl:指定要显示的字段,默认显示全部字段,fl=id name price
[/list]
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><!--主键-->
本文详细介绍了Solr搜索引擎中的常见查询参数及其用途,包括排序、分页等功能,并深入解析了schema.xml配置文件中针对文本字段类型的定义及分析器设置。
443

被折叠的 条评论
为什么被折叠?



