设为首页 收藏本站
查看: 2448|回复: 0

[经验分享] solr search基础知识(控制符及其参数)

[复制链接]
累计签到:2 天
连续签到:1 天
发表于 2015-7-19 08:16:30 | 显示全部楼层 |阅读模式
  1、^ 控制符
  (1)查询串上用^
  搜索: 天后王菲,如果希望将王菲的相关度加大,用^控制符。
  天后  王菲^10.5  结果就会将含有王菲的document权重加大分数提高,排序靠前,10.5为权重。
  

  (2)feild上用^
  name ^ 10
  即name含有搜索串时候,权重比content含有搜索串的权重高,分数也就高。
DSC0000.jpg

  2、*符号
  当分词器中是最大切分时候,搜索小单元词汇“海波”,如果分析器都分析为“黄海波”,那么则用  *海波*  能搜索出结果!!
  

  3、OR符号
  要想既搜索   【黄海波  视频】 又搜索【黄海波】,搜索串可以写成: "黄海波  视频"  黄海波                 或者      "黄海波  视频"   OR  黄海波
  注意:+ - && || ! ( ) { } [ ] ^ " ~ * ? : /     需要用反斜杠实现转义!
  

  4、括号-组搜索
  (黄奕  OR 视频) 黄海波 =====》搜索  黄奕 AND 黄海波     视频 AND 黄海波
  区间搜索:黄海波  AND last_modified:[2015-03-06T23:59:59.999Z TO *]  时间要大于2015年的。。。。结果

  

  5、dismax中的 mm
  当mm不设置的时候:如果设置boolean 查询逻辑为 AND,则mm = 100% 搜索串被切分后的词语必须都出现,如果查询逻辑为OR,则mm=1  出现搜索串切分后的其中一个词语就可以。
  mm:值可以使正正数,负整数,正的百分数,负的百分数。正数表示分析器分词后必须出现的个数,负数表示可以不出现词语的个数。
  如mm : -2 表示可以有任意2个词语不出现!
  

  6、bq boost query
  The  parameter specifies an additional, optional, query clause that will be added to the user's main query to influence the score. For example, if bq
you wanted to add a relevancy boost for recent documents:

  bq=date:[NOW/DAY-1YEAR TO NOW/DAY] 给距今一年内的文档的相关度提高。

  

  7、各个配置参数解释:
  (1)  qf(query feild):  the  parameter introduces a list of fields, each of which is assigned a boost factor to increase or decrease that particular field's importance in qf
the query. 针对某个feild增加boost权重,提高该feild上的搜索相关度
  (2)  mm(Minimum Should Match)  :
  mm:值可以使正正数,负整数,正的百分数,负的百分数。正数表示分析器分词后必须出现的个数,负数表示可以不出现词语的个数。
  如mm : -2 表示可以有任意2个词语不出现!
  (3)  pf(phrase feilds):  Once the list of matching documents has been identified using the  and  parameters, the  parameter can be used to "boost" the score of fq qf pf
documents in cases where all of the terms in the q parameter appear in close proximity.
The format is the same as that used by the  parameter: a list of fields and "boosts" to associate with each of them when making phrase queries qf
out of the entire q parameter用于指定一组field,当query完全匹配pf指定的某一个field时,来进行boost。
  (4)  ps(phrase slop ):
  (5)  qs(query phrase slop):
  (6)  tie(tie breaker):The  parameter specifies a float value (which should be something much less than 1) to use as tiebreaker in DisMax queries. tie
When a term from the user's input is tested against multiple fields, more than one field may match. If so, each field will generate a different score
based on how common that word is in that field (for each document relative to all other documents). The  parameter lets you control how tie
much the final score of the query will be influenced by the scores of the lower scoring fields compared to the highest scoring field.
A value of "0.0" makes the query a pure "disjunction max query": that is, only the maximum scoring subquery contributes to the final score. A
value of "1.0" makes the query a pure "disjunction sum query" where it doesn't matter what the maximum scoring sub query is, because the final
score will be the sum of the subquery scores. Typically a low value, such as 0.1, is useful. 这个参数很少用到
  (7) bq(boost query): The  parameter specifies an additional, optional, query clause that will be added to the user's main query to influence the score. For example, if bq
you wanted to add a relevancy boost for recent documents:
q=cheese
bq=date:[NOW/DAY-1YEAR TO NOW/DAY]
  (8)bf(boost function):The  parameter specifies functions (with optional boosts) that will be used to construct FunctionQueries which will be added to the user's main bf
query as optional clauses that will influence the score. Any function supported natively by Solr can be used, along with a boost value.
  (9)qt(query type):指定那个类型的request handler来处理查询请求,一般不用指定,默认是standard.(4.1以后默认的standard是 dismax query parser,4.1之前默认的是 standard query parser)
  (10)qf(queryfields):指定solr从哪些field中搜索。当在solrconfig中配置了qf,就会和schema中配置的默认搜索域????????都被搜索
  (11)pf:phrase query,pf2(Phrasebigram fields):"the big pig"----"the big"   "big pig"
  pf3: (Phrase trigram fields):"the nice big pig"---"the nice big"   "nice big pig"
  (12)bf:boost function:   recip(rord(myfield),1,2,3)^1.5;    recip(ms(NOW,mydatefield),3.16e-11,1,1)理解这些公式需要看functionQuery相关内容。

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-88113-1-1.html 上篇帖子: Solr auto commit 配置 下篇帖子: Solr版本安装部署指南
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表