solr查询参数

2019-03-27 01:11|来源: 网路

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.xmldefaultOperator(有空格时用"AND"还是用"OR"操作逻辑)。
df:
默认的查询字段。
qt:
query type,指定那个类型来处理查询请求,一般不用指定,默认是standard


转自:http://www.cnblogs.com/hbscx/p/3200331

相关问答

更多
  • public static Map<String, Integer> queryByGroup(String qStr,String groupField,String sortField,boolean asc,Integer pageSize,Integer pageNum){ Map<String, Integer> rmap = new LinkedHashMap<String, Integer>(); try { SolrServer server = getS ...
  • 我不知道为什么这不工作,但这是逻辑上相同的,它的工作: -(myField:superneat AND -myOtherField:somethingElse) 也许这与在查询中定义相同的字段两次有关 尝试在solr-user组中询问,然后在这里发回最后的答案! I don't know why that doesn't work, but this one is logically equivalent and it does work: -(myField:superneat AND -myOther ...
  • 您不能只将响应中的内容复制到配置文件中 - 这两种格式完全不同。 引用的是, defaults部分中的每个条目都被添加到查询字符串中(除非它们已经在那里提供 - 如果要强制某个不能被覆盖的值,也有选项)。 [...] somehost:port1/s ...
  • 如果其他人遇到此问题,则与CSV更新端点无关,而是我如何在架构中定义uniqueKey字段。 以下不起作用: 但是当我将类型更改为字符串时它确实有效: 据我所知,这在SOLR维基上的任何 ...
  • 一般答案 我无法使用Field Collapsing paramaters折叠结果。 但是,我能够使用CollapsingQParserPlugin实现所需的结果。 以下过滤器查询会折叠字段“图片”上的文档,并选择字段“展示次数”值最高的文档: {!collapse field=image max=impressions} 履行 出于某种原因,我无法将此过滤器查询与我在单个键下的其他过滤器查询相结合,如下所示: $filterQueries = [ "-signature:{$signature}" ...
  • 如果你这样做,只会使用入口缓存,缓存的文档将会符合所有3个子句。 如果你的字段的基数很大,并且查询有几个ANDS,那么你可能会注意到如果你使用'fq,整个事物'的方法可能会有较少的缓存命中(因为它不太可能使用相同的组合所有的领域),所以在这种情况下,最好将每个领域放在自己的fq中。 If you do that, only an entry cache will be used, cached docs will be the ones that comply with all 3 clauses. If ...
  • q=*:*搜索所有文档中的所有内容,因此您可以获得结果。 q=white将在默认搜索字段中搜索白色,如果您尚未修改schema.xml,则通常是文本。 text 您可以将默认字段更改为要搜索的字段。 或使用特定字段搜索特定字段,例如标题q=title:white 如果要搜索多个字段,可以使用copyfields将字段组合到一个字段中,或使用dismax请求处理程序。 q=*:* searches for all conten ...
  • 首先,我认为Solr通配符比“1或多个”更好地归纳为“0或多个”。 我怀疑这是你问题的根源。 (例如,请参阅WildcardQuery的javadoc 。) 其次,你是否在使用词干,因为我的第一个猜测是你正在处理一个词干问题。 Solr通配符在词干方面可能表现得很奇怪。 这是因为通配符扩展是通过搜索存储在倒排索引中的术语列表来进行的; 这些术语将以词干形式出现(可能类似“gatorad”),而不是来自原始源文本(可能是“gatorade”或“gatorades”)的单词。 例如,假设你有一个词干分析器,把“ ...
  • dataDir是Solr将存储索引数据的目录(默认情况下,它位于Solr主目录中的./data下)。 您可以使用它来设置不同的路径。 它不是备份。 更多信息在这里 。 这不可能产生性能影响。 除非您将其指向文件系统中位于更快磁盘上的另一个挂载点。 我认为最好的做法是将dataDir放在Solr主目录之外,这样您就可以升级Solr,而无需担心数据的存储位置。 如果您的服务器上有多个磁盘,这很有用。 dataDir is the directory where Solr will store your inde ...
  • 你不能只使用 Job.search do adjust_solr_params do |params| params.except! :fq end end 或类似的东西,以从params散列中删除:fq键 Can't you just use Job.search do adjust_solr_params do |params| params.except! :fq end end Or something similiar in order to remove the :fq ...