日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

【solr专题之二】配置文件:solr.xml solrConfig.xml schema.xml

發布時間:2025/6/17 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【solr专题之二】配置文件:solr.xml solrConfig.xml schema.xml 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.


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的定義如下: <str name="qf">text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4title^10.0 description^5.0 keywords^5.0 author^2.0 resourcename^1.0</str>由于content不占任何的權重,因此如果某個文檔只在content中包含關鍵字的話,搜索結果并不會返回這個文檔。因此,對于nutch提取的索引來說,要增加content的權重,以及url的權重(如果需要的話): <str name="qf">content^1.0 text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4title^10.0 description^5.0 keywords^5.0 author^2.0 resourcename^1.0</str>

二、Search Handler

[html]?view plaincopy
  • <requestHandler?name="/browse"?class="solr.SearchHandler">??
  • ????<lst?name="defaults">??
  • ??????<str?name="echoParams">explicit</str>??
  • ??
  • ??????<!--?VelocityResponseWriter?settings?-->??
  • ??????<str?name="wt">velocity</str>??
  • ??????<str?name="v.template">browse</str>??
  • ??????<str?name="v.layout">layout</str>??
  • ??????<str?name="title">Solritas_test</str>??
  • ??
  • ??????<!--?Query?settings?-->??
  • ??????<str?name="defType">edismax</str>??
  • ??????<str?name="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??
  • ??????</str>??
  • ??????<str?name="df">content</str>??
  • ??????<str?name="mm">100%</str>??
  • ??????<str?name="q.alt">*:*</str>??
  • ??????<str?name="rows">10</str>??
  • ??????<str?name="fl">*,score</str>??
  • ??????<!--more?like?this?setting-->??
  • ??????<str?name="mlt.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??
  • ??????</str>??
  • ??????<str?name="mlt.fl">text,features,name,sku,id,manu,cat,title,description,keywords,author,resourcename</str>??
  • ??????<int?name="mlt.count">3</int>??
  • ??
  • ??????<!--?Faceting?defaults?-->??
  • ??????<str?name="facet">on</str>??
  • ??????<str?name="facet.field">cat</str>??
  • ??????<str?name="facet.field">manu_exact</str>??
  • ??????<str?name="facet.field">content_type</str>??
  • ??????<str?name="facet.field">author_s</str>??
  • ??????<str?name="facet.query">ipod</str>??
  • ??????<str?name="facet.query">GB</str>??
  • ??????<str?name="facet.mincount">1</str>??
  • ??????<str?name="facet.pivot">cat,inStock</str>??
  • ??????<str?name="facet.range.other">after</str>??
  • ??????<str?name="facet.range">price</str>??
  • ??????<int?name="f.price.facet.range.start">0</int>??
  • ??????<int?name="f.price.facet.range.end">600</int>??
  • ??????<int?name="f.price.facet.range.gap">50</int>??
  • ??????<str?name="facet.range">popularity</str>??
  • ??????<int?name="f.popularity.facet.range.start">0</int>??
  • ??????<int?name="f.popularity.facet.range.end">10</int>??
  • ??????<int?name="f.popularity.facet.range.gap">3</int>??
  • ??????<str?name="facet.range">manufacturedate_dt</str>??
  • ??????<str?name="f.manufacturedate_dt.facet.range.start">NOW/YEAR-10YEARS</str>??
  • ??????<str?name="f.manufacturedate_dt.facet.range.end">NOW</str>??
  • ??????<str?name="f.manufacturedate_dt.facet.range.gap">+1YEAR</str>??
  • ??????<str?name="f.manufacturedate_dt.facet.range.other">before</str>??
  • ??????<str?name="f.manufacturedate_dt.facet.range.other">after</str>??
  • ??
  • ??????<!--?Highlighting?defaults?-->??
  • ??????<str?name="hl">on</str>??
  • ??????<str?name="hl.fl">content?features?title?name</str>??
  • ??????<str?name="hl.encoder">html</str>??
  • ??????<str?name="hl.simple.pre"></str>??
  • ??????<str?name="hl.simple.post"></str>??
  • ??????<str?name="f.title.hl.fragsize">0</str>??
  • ??????<str?name="f.title.hl.alternateField">title</str>??
  • ??????<str?name="f.name.hl.fragsize">0</str>??
  • ??????<str?name="f.name.hl.alternateField">name</str>??
  • ??????<str?name="f.content.hl.snippets">3</str>??
  • ??????<str?name="f.content.hl.fragsize">200</str>??
  • ??????<str?name="f.content.hl.alternateField">content</str>??
  • ??????<str?name="f.content.hl.maxAlternateFieldLength">750</str>??
  • ??
  • ??????<!--?Spell?checking?defaults?-->??
  • ??????<str?name="spellcheck">on</str>??
  • ??????<str?name="spellcheck.extendedResults">false</str>?????????
  • ??????<str?name="spellcheck.count">5</str>??
  • ??????<str?name="spellcheck.alternativeTermCount">2</str>??
  • ??????<str?name="spellcheck.maxResultsForSuggest">5</str>?????????
  • ??????<str?name="spellcheck.collate">true</str>??
  • ??????<str?name="spellcheck.collateExtendedResults">true</str>????
  • ??????<str?name="spellcheck.maxCollationTries">5</str>??
  • ??????<str?name="spellcheck.maxCollations">3</str>?????????????
  • ????</lst>??
  • ??
  • ????<!--?append?spellchecking?to?our?list?of?components?-->??
  • ????<arr?name="last-components">??
  • ??????<str>spellcheck</str>??
  • ????</arr>??
  • ?</requestHandler>??

  • 1、SearchHandler是reqestHandler中的一種,它以requestHandler作為頂層元素。

    2、二級元素包括first-components, ?last-components, defautls等。

    3、Velocity的配置

    [html]?view plaincopy
  • <!--?VelocityResponseWriter?settings?-->??
  • <str?name="wt">velocity</str>??
  • <str?name="v.template">browse</str>??
  • <str?name="v.layout">layout</str>??
  • <str?name="title">Solritas_test</str>??
  • wt:指定返回搜索結果的格式

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

    • v.template.<name>: 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.csdn.net/jediael_lu/article/details/38039267。

    4、搜索域qf

    [html]?view plaincopy
  • <str?name="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??
  • </str>??
  • 定義了從哪些域進行搜索,以及各個域之間的權重。


    5、QueryParser的選擇 defType,常用efType=lucene, defType=edismax

    [html]?view plaincopy
  • <str?name="defType">edismax</str>??

  • 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
  • <str?name="q.alt">*:*</str>??
  • q.alt: 當q字段為空時,用于設置缺省的query,通常設置q.alt為*:*。


    8、?mm:minimal should match。Solr支持三種查詢clause,即“必須出現”, “不能出現”和“可以出現”,分別對應于AND, -, OR。

    [html]?view plaincopy
  • <str?name="mm">100%</str>??

  • 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<-25%"

    • If there are less than 3 optional clauses, they all must match; for 3 to 5 clauses, one less than the number of clauses must match, for 6 or more clauses, 80% must match, rounded down: "2<-1?5<80%"

    Full details on the variety of complex expressions supported are explained in detail?here.

    In Solr 1.4 and prior, you should basically set mm=0 if you want the equivilent of q.op=OR, and mm=100% if you want the?equivilent of q.op=AND. In 3.x and trunk the default value of mm is dictated by the q.op?param (q.op=AND => mm=100%; q.op=OR => mm=0%). Keep in mind the default operator is effected by your schema.xml <solrQueryParser defaultOperator="xxx"/> entry. In older versions of Solr the default value is 100% (all clauses must match)

    9、每頁返回的行數

    [html]?view plaincopy
  • <str?name="rows">10</str>??

  • 10、返回Field的集合

    [html]?view plaincopy
  • <str?name="fl">*,score</str>??
  • fl: 是逗號分隔的列表,用來指定文檔結果中應返回的?Field?集。默認為 “*”,指所有的字段。以上即返回所有域,而加上score。


    11、對返回結果排序

    (1)排序的字段必須是index=true

    (2)<str name="sort">tstamp asc</str>?

    若此元素放在<default>中,則指定默認元素,query時可以改變。

    若放在<invariant>中,則在query中也不可以改變。

    這應該對其它元素同樣適用。

    參考:http://stackoverflow.com/questions/24966924/how-to-change-the-default-rank-field-from-score-to-other-filed-in-solr/24971353#24971353



    轉載于:https://www.cnblogs.com/eaglegeek/p/4557878.html

    總結

    以上是生活随笔為你收集整理的【solr专题之二】配置文件:solr.xml solrConfig.xml schema.xml的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

    主站蜘蛛池模板: 九一网站在线观看 | 国产女主播自拍 | 亚洲成人三区 | 国产操比视频 | 狼人狠狠干 | 亚洲春色在线 | 天天摸天天操天天射 | 国产视频一区二区三区在线观看 | 亚洲最大福利视频 | 和美女啪啪| 天堂中文8 | 男生裸体视频网站 | wwwxxx在线观看 | 疯狂撞击丝袜人妻 | 有码中文字幕 | 日韩视频免费观看高清 | 日本精品久久久久久久 | 国产视频污 | 亚洲av无码精品色午夜果冻不卡 | 久久久国产亚洲 | 午夜免费一区 | 自拍偷拍一区二区三区 | 在线免费av观看 | 九九九免费视频 | 午夜影院在线播放 | wwwxxx黄色片| 99精彩视频 | 欧洲性猛交 | 欧美午夜精品久久久久久浪潮 | 香蕉网站在线观看 | 青青草久久久 | 中文字幕日韩欧美 | 肉体粗喘娇吟国产91 | 岛国av免费在线观看 | 久久精品a | 午夜精品视频在线观看 | 亚洲一级片在线播放 | 日韩综合一区二区三区 | 免费视频黄色 | 91久精品 | 日韩国产亚洲欧美 | 日韩中文娱乐网 | 女av在线 | 久久精品视频91 | 中文字幕第12页 | 日韩中文字幕二区 | 黄色av网站免费看 | 黄色二级视频 | 尹人久久 | 少妇做爰免费视看片 | 欧美色淫| 手机在线永久免费观看av片 | 四虎永久在线视频 | 午夜在线不卡 | 在线观看视频中文字幕 | 一区二区伦理 | 捆绑裸体绳奴bdsm亚洲 | 午夜精品影院 | 国产第6页 | avav亚洲| 日韩精品黄 | 精品一区二区三区免费 | 欧美成人aaaa| 国产免费一区二区三区三州老师 | 亚洲天堂婷婷 | 粉嫩av一区二区三区天美传媒 | 国产三级三级三级三级三级 | www.四虎精品 | 91少妇丨porny丨 | 日韩av资源在线观看 | 精品国产精品国产偷麻豆 | 久久资源365 | 四虎影院www | 国产免费一区二区三区 | www.中文字幕.com | 国产成人综合久久 | 国产成人精品999在线观看 | 欧美精品一卡二卡 | 老司机免费在线视频 | 日韩高清二区 | 一区在线不卡 | 不卡一区二区三区四区 | 中文字幕乱码在线观看 | a∨鲁丝一区鲁丝二区鲁丝三区 | 制服 丝袜 综合 日韩 欧美 | 国产一区二区91 | 九色福利视频 | 免费特黄视频 | 午夜伦伦电影理论片费看 | 午夜在线不卡 | 青草成人免费视频 | 性色影院| 亚洲视频综合 | 色婷婷中文字幕 | 免费精品在线观看 | 都市激情久久 | 被黑人各种姿势猛c哭h文1 | 91免费版视频 | 免费看一区二区三区 |