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

[经验分享] 【solr专题之二】配置文件:solr.xml solrConfig.xml schema.xml

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-7-19 08:20:50 | 显示全部楼层 |阅读模式
  


  1、关于默认搜索域
  


If you are using the Lucene query parser, queries that don't specify a field name will use the defaultSearchField. The DisMax and Extended DisMax query parsers do not use this value.




Use of the defaultSearchField element is deprecated in Solr versions 3.6 and higher. Instead, you should use the df request parameter. At some point, the defaultSearchField
element may be removed。

即使用solrConfig中的df属性代替schema中的defaultSearchField。





2、关于qf





从solr的example中得到的solrConfig.xml中,qf的定义如下:

      
text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
title^10.0 description^5.0 keywords^5.0 author^2.0 resourcename^1.0
由于content不占任何的权重,因此如果某个文档只在content中包含关键字的话,搜索结果并不会返回这个文档。因此,对于nutch提取的索引来说,要增加content的权重,以及url的权重(如果需要的话):

      
content^1.0 text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
title^10.0 description^5.0 keywords^5.0 author^2.0 resourcename^1.0




二、Search Handler











[html] view
plaincopy




  •   

  •       

  •       explicit  

  •   

  •         

  •       velocity  

  •       browse  

  •       layout  

  •       Solritas_test  

  •   

  •         

  •       edismax  

  •         

  •          text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4  

  •          title^10.0 description^5.0 keywords^5.0 author^2.0 resourcename^1.0  

  •         

  •       content  

  •       100%  

  •       *:*  

  •       10  

  •       *,score  

  •         

  •         

  •         text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4  

  •         title^10.0 description^5.0 keywords^5.0 author^2.0 resourcename^1.0  

  •         

  •       text,features,name,sku,id,manu,cat,title,description,keywords,author,resourcename  

  •       3  

  •   

  •         

  •       on  

  •       cat  

  •       manu_exact  

  •       content_type  

  •       author_s  

  •       ipod  

  •       GB  

  •       1  

  •       cat,inStock  

  •       after  

  •       price  

  •       0  

  •       600  

  •       50  

  •       popularity  

  •       0  

  •       10  

  •       3  

  •       manufacturedate_dt  

  •       NOW/YEAR-10YEARS  

  •       NOW  

  •       +1YEAR  

  •       before  

  •       after  

  •   

  •         

  •       on  

  •       content features title name  

  •       html  

  •         

  •         

  •       0  

  •       title  

  •       0  

  •       name  

  •       3  

  •       200  

  •       content  

  •       750  

  •   

  •         

  •       on  

  •       false         

  •       5  

  •       2  

  •       5         

  •       true  

  •       true   

  •       5  

  •       3            

  •       

  •   

  •       

  •       

  •       spellcheck  

  •       

  •    
  

  




1、SearchHandler是reqestHandler中的一种,它以requestHandler作为顶层元素。  
2、二级元素包括first-components,  last-components, defautls等。
  
3、Velocity的配置
  








[html] view
plaincopy




  •   

  • velocity  

  • browse  

  • layout  

  • Solritas_test  

wt:指定返回搜索结果的格式  

  




  • v.template: template name to use, without the .vm suffix. If not specified, "default"[.vm] will be used.

  • v.template.: overrides a file system template

  • debugQuery: if true, default view displays explanations for each hit and additional debugging information in the footer.

  • v.json: Escapes and wraps Velocity generated response with v.json parameter as a JavaScript function.

  • v.layout: Template name that wraps main template (v.template). Main template renders to a $content that can be used in layout template.

  • v.base_dir: overwrites default template load path (conf/velocity/).

  • v.properties: specifies a Velocity properties file to be applied, found using the Solr resource loader mechanism. If not specified, no .properties file is loaded. Example: v.properties=velocity.properties
    where velocity.properties can be found using Solr's resource loader mechanism, for example in the conf/ directory (not conf/velocity which is for templates only). The .properties file could also be located inside a JAR in the lib/ directory, or other locations.

  • v.contentType: sets the value of the HTTP response's Content-Type header (in case (x)html pages should be UTF-8 (instead of ISO-8859-1) encoded, make sure you set this option to text/xml;charset=UTF-8 (for
    XHTML) and text/html;charset=UTF-8 (for HTML), respectively)


  

  
velocity的其余配置参考:http://blog.iyunv.com/jediael_lu/article/details/38039267。
  
4、搜索域qf
  








[html] view
plaincopy




  •   

  •    text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4  

  •    title^10.0 description^5.0 keywords^5.0 author^2.0 resourcename^1.0  

  •   

定义了从哪些域进行搜索,以及各个域之间的权重。  

  



  
5、QueryParser的选择 defType,常用efType=lucene, defType=edismax
  








[html] view
plaincopy




  • edismax  
  






6、默认搜索域:df  

  
若无指定搜索域,则此域作为默认的搜索域。
  
df/qf/defaultSearchField比较:
  
(1)使用solrConfig中的df属性代替schema中的defaultSearchField。


  
(2)df is
the default field and will only take effect if the qf is
not defined.


  
7、默认的query
  








[html] view
plaincopy




  • *:*  
  

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



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








[html] view
plaincopy




  • 100%  
  





  


When dealing with queries there are 3 types of "clauses" that Lucene knows about: mandatory, prohibited, and 'optional' (aka: "SHOULD") By default all words or phrases specified in the "q" param are treated as "optional" clauses unless they are preceeded by
a "+" or a "-". When dealing with these "optional" clauses, the "mm" option makes it possible to say that a certain minimum number of those clauses must match (mm). Specifying this minimum number can be done in complex ways, equating to ideas like...



  • At least 2 of the optional clauses must match, regardless of how many clauses there are: "2"

  • At least 75% of the optional clauses must match, rounded down: "75%"

  • If there are less than 3 optional clauses, they all must match; if there are 3 or more, then 75% must match, rounded up: "2

运维网声明 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-88115-1-1.html 上篇帖子: Solr版本安装部署指南 下篇帖子: solr fieldType
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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