Solr中的一些查询参数

fl: 是逗号分隔的列表,用来指定文档结果中应返回的 Field 集。默认为 “*”,指所有的字段。

defType: 指定query parser,常用defType=lucene, defType=dismax, defType=edismax

q: query。

q.alt: 当q字段为空时,用于设置缺省的query,通常设置q.alt为*:*。

qf: query fields,指定solr从哪些field中搜索。

pf: 用于指定一组field,当query完全匹配pf指定的某一个field时,来进行boost。

简言之pf的作用是boosting phrases over words。

fq: filter query,过虑查询。

mm: minimal should match。Solr支持三种查询clause,即“必须出现”, “不能出现”和“可以出现”,分别对应于AND, -, OR。

在默认情况下,使用OR这个clause。mm用于设置在使用OR这个clause时,需要出现最少的满足条件的clause数量,详见这里

ps: Phrase Slop. Amount of slop on phrase queries built for "pf" fields (affects boosting). ps is about pf parameter. ps affects boosting, if you play with ps value, numFound and result set do not change. But the order of result set change. This is about the phrase query that is constructed out of the entire "q" param. ps is slop applied to the phrases created from the entire query for evaluating pf boosts. ps will only (potentially) change the ranked ordering of your result set, by loosening what a "phrase match" means to the pf boost.

ps的例子:

Lets say your query is apache solr. (without quotation marks)

Lets say these three documents contains all of these words and returned.

1-) solr is built on the top of apache lucene.

2-) apache solr is fast, mature and popular.

3-) solr is hosted under apache umbrella.

Even if you don‘t use pf and ps parameters, those
documents will be in result set anyway. Lets say that they appear in
this order 1,2,3.

Then we include pf and ps parameter, q=apache solr&pf=title^1.2&ps=1

Second document is boosted, lets say it comes first
now. The order is changed. The documents - that have the all query words
close each other - are boosted. Again the same three documents are
returned.

qs: Query Phrase Slop. Amount of
slop on phrase queries explicitly included in the user‘s query string
(in qf fields; affects matching). qs affects matching. If you play with qs, numFound changes. This parameter is about when you have explicit phrase query in your raw query. i.e. &q="apache lucene" . qs is slop applied to phrases explicitly in the &q with double quotes. qs will (potentially) change your result set.

tie: tie breaker。

bq: 对某个field的value进行boost,例如brand:IBM^5.0。

bf: Function (with optional boosts) that will be
included in the user‘s query to influence the score. Any function
supported natively by Solr can be used, along with a boost value, e.g.:
recip(rord(myfield),1,2,3)^1.5

wt: writer type,指定输出格式,可以有 xml, json, php, phps。

q.op: 覆盖schema.xml的defaultOperator(有空格时用"AND"还是用"OR"操作逻辑)。
df: 默认的查询字段。
qt: query type,指定那个类型来处理查询请求,一般不用指定,默认是standard。

时间: 2024-08-16 07:01:42

Solr中的一些查询参数的相关文章

solr与.net系列课程(四)solr查询参数的讲解与.net如何获取solr数据

solr与.net系列课程(四)solr查询参数的讲解与.net如何获取solr数据 上一节我们完成了solr连接数据库,细心的朋友会发现一个问题,就是solr其实和语言没有任何关系,配置完成后任何语言都可以直接调用,本章我们主要对solr的查询做出讲解,然后就是新接触的人最关心的.net如何获取solr中的数据. 本节我准备了一个300万左右的数据表,为大家做演示 然后我们开始配置schema.xml 文件: <field name="id" type="string

Solr学习总结(四)Solr查询参数

今天还是不会涉及到java和数据库操作,主要还是总结Solr 的查询参数,还是那句话,只有先明白了solr的基础内容和查询语法,后续学习solr 的java和数据库操作,都是水到渠成的事.这里先列出solr查询所需要的参数 wiki 地址:http://wiki.apache.org/solr/FrontPage, 里面有各个参数详细的介绍. 一.基本查询 q  查询的关键字,此参数最为重要,例如,q=id:1,默认为q=*:*, fl  指定返回哪些字段,用逗号或空格分隔,注意:字段区分大小写

solr查询参数、语法、函数总结

查询参数: qt               query type,指定那个类型来处理查询请求,一般不用指定,默认是standard. fl      查询返回哪些字段. q       query(查询字符串,必须的). fq               过滤查询   (filter query). start           分页用,起始位置. rows           分页用,返回多少条记录. sort             排序. wt               输出格式  

Solr的一些查询参数

fl: 是逗号分隔的列表,用来指定文档结果中应返回的 Field 集.默认为 "*",指所有的字段. defType: 指定query parser,常用defType=lucene, defType=dismax, defType=edismax q: query. q.alt: 当q字段为空时,用于设置缺省的query,通常设置q.alt为*:*. qf: query fields,指定solr从哪些field中搜索. pf: 用于指定一组field,当query完全匹配pf指定的

如何从angular2中的url获取查询参数?

问题描述 我使用angular2.0.0-beta.7.当组件在像”/path?query=value1″这样的路径上加载时,它被重定向到”/path”.为什么删除了GET参数?如何保留参数? 路由器出现错误.如果我有一条主路线 @RouteConfig([ { path: '/todos/...', name: 'TodoMain', component: TodoMainComponent } ]) 和我的孩子路线一样 @RouteConfig([ { path: '/', componen

获取request中的查询参数

//获取request中的查询参数 public static Map<String, Object> getRequestParamsByMap(HttpServletRequest request) { Map<String,Object> qmap=new HashMap<String,Object>(); Enumeration<String> paraNames = request.getParameterNames(); while(paraNa

solr入门之多线程操作solr中索引字段的解决

涉及的问题: 建索引时有一个字段是该词语出现的次数,这个字段是放在solr里的 而我用的是多线程来进行全量导入的,这里就涉及到了多线程问题 多个线程操作同一个变量时如何处理? 我是这样子做的 : 首先将变量本地话--分布式就放到大容器中,我这里仅仅使用了一个map来存 词和次数的关系映射 变量本地化后就是多线程的解决了--锁的设置-我仅仅是在操作时加了一个锁来解决这个问题 这样做后总体上应该能解决变量的问题了 最后还有一个线程顺序问题要解决下 当 最后一个提交索引时 获取的索引不一定是正确的索引

Solr实现Low Level查询解析(QParser)

Solr实现Low Level查询解析(QParser) Solr基于Lucene提供了方便的查询解析和搜索服务器的功能,可以以插件的方式集成,非常容易的扩展我们自己需要的查询解析方式.其中,Solr内置了一些QParser,对一些没有特殊要求的应用来说,可以直接使用这些查询解析组件,而无需做任何修改,只需要了解这些查询解析组件提供的基本参数(Local Params),就可以实现强大的搜索功能. 对于Solr来说,它的设计目标就是尽可能屏蔽底层Lucene的复杂度和难点,而是通过提供可配置的方

solr中solrconfig.xml详解

前段时间在网上搜索些solrconfig的配置文件资料,发现大都比较零散.因此花了段时间整理相关内容. 推荐部分相关资料:http://www.luoshengsha.com/197.html http://guohf.iteye.com/blog/1440838  这个也对solrconfig总结的比较详细. <?xml version="1.0" encoding="UTF-8" ?> <config> <abortOnConfig