【发布时间】:2016-10-24 09:44:41
【问题描述】:
在我的 schema.xml 中,所有字段的条目如下:
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="name" type="text_general" indexed="true" stored="true"/>
<field name="description" type="text_general" indexed="true" stored="true"/>
<field name="manu" type="text_general" indexed="true" stored="true" omitNorms="true"/>
<field name="producturl" type="string" indexed="false" stored="true" required="true"/>
<field name="imageurl" type="string" indexed="false" stored="true" />
<field name="category" type="text_general" indexed="true" stored="true" omitNorms="true"/>
<field name="categorypath" type="lowercase" indexed="true" stored="true" />
<field name="weight" type="float" indexed="true" stored="true"/>
<field name="price" type="float" indexed="true" stored="true"/>
<field name="popularity" type="int" indexed="true" stored="true" />
<field name="inStock" type="boolean" indexed="true" stored="true" />
<field name="last_modified" type="date" indexed="true" stored="true"/>
<field name="store" type="text_general" indexed="true" stored="true" omitNorms="true"/>
我正在尝试搜索,如果存在于类别中的搜索字符串必须高于名称中存在搜索字符串的结果。我尝试了以下查询,但总是得到名称中存在查询字符串的结果。
http:///solr//select?debugQuery=on&indent=on&q=查询:"{!edismax mm='100%25' qf='manu^10.0' v=$q1 }" OR 查询:"{!edismax mm='100%25' qf='name^0.2' v=$q1}" OR 查询:"{!edismax mm='100%25' qf='category^10.0' v=$q1}" OR 查询:"{!edismax mm='100%25' qf='categorypath^5.0' v= $q1}"&q1=mobile&wt=csv
上述查询的sn-p结果如下:
mrp_d,manu,description,discount_i,store,_version_,price,categorypath,imageurl,name,id,category,producturl,last_modified
60.68,Not Specified,,50,Lazada,1549123070131699713,30.34,Women|Wallets & Accessories,http://srv-live.lazada.com.my/p/image-78714241-16244bcc8b6488fa7c5dc3479b6b6f69-product.jpg,Fashion Women Lady Cute Cat Clutch Long Purse Wallet Card Holder Mobile Bag Green,LZDNO037FAAA8H917ANMY-18042381,Wallets & Accessories,http://ho.lazada.com.my/SHHSoo?url=http%3A%2F%2Fwww.lazada.com.my%2Ffashion-women-lady-cute-cat-clutch-long-purse-wallet-card-holder-mobile-bag-green-14241787.html%3Foffer_id%3D%7Boffer_id%7D%26affiliate_id%3D%7Baffiliate_id%7D%26offer_name%3D%7Boffer_name%7D_%7Boffer_file_id%7D%26affiliate_name%3D%7Baffiliate_name%7D%26transaction_id%3D%7Btransaction_id%7D&aff_sub=&aff_sub2=&aff_sub3=&aff_sub4=&aff_sub5=,2016-10-25T01:27:53Z
60.3,Not Specified,,50,Lazada,1549123070201954306,30.15,Women|Wallets & Accessories,http://srv-live.lazada.com.my/p/image-53144241-27196219e745476ccd5b10cb0febf37b-product.jpg,Fashion Women Flower Long Zip Wallet Card Holder Mobile Bag Clutch Purse Pockets Navy Blue,LZDNO037FAAA8HAUFANMY-18045720,Wallets & Accessories,http://ho.lazada.com.my/SHHSoo?url=http%3A%2F%2Fwww.lazada.com.my%2Ffashion-women-flower-long-zip-wallet-card-holder-mobile-bag-clutch-purse-pockets-navy-blue-14244135.html%3Foffer_id%3D%7Boffer_id%7D%26affiliate_id%3D%7Baffiliate_id%7D%26offer_name%3D%7Boffer_name%7D_%7Boffer_file_id%7D%26affiliate_name%3D%7Baffiliate_name%7D%26transaction_id%3D%7Btransaction_id%7D&aff_sub=&aff_sub2=&aff_sub3=&aff_sub4=&aff_sub5=,2016-10-25T01:27:53Z
84.66,Not Specified,,66,Lazada,1549123070268014594,28.22,Women|Bags & Clutches|Handbags,http://srv-live.lazada.com.my/p/image-63215241-13718b9bf73f9ba09610037ef9ac8dad-product.jpg,ERA New Women Vintage Leather Coin Cell Phone Mobile Mini Cross-body Shoulder Bag,LZDNO037FAAA8HGBOANMY-18055171,Handbags,http://ho.lazada.com.my/SHHSoo?url=http%3A%2F%2Fwww.lazada.com.my%2Fera-new-women-vintage-leather-coin-cell-phone-mobile-mini-cross-body-shoulder-bag-14251236.html%3Foffer_id%3D%7Boffer_id%7D%26affiliate_id%3D%7Baffiliate_id%7D%26offer_name%3D%7Boffer_name%7D_%7Boffer_file_id%7D%26affiliate_name%3D%7Baffiliate_name%7D%26transaction_id%3D%7Btransaction_id%7D&aff_sub=&aff_sub2=&aff_sub3=&aff_sub4=&aff_sub5=,2016-10-25T01:27:53Z
84.66,Not Specified,,66,Lazada,1549123070268014595,28.22,Women|Bags & Clutches|Handbags,http://srv-live.lazada.com.my/p/image-93215241-08f2151a427d52295328a5d7e5addce1-product.jpg,ERA New Women Vintage Leather Coin Cell Phone Mobile Mini Cross-body Shoulder Bag,LZDNO037FAAA8HGBRANMY-18055174,Handbags,http://ho.lazada.com.my/SHHSoo?url=http%3A%2F%2Fwww.lazada.com.my%2Fera-new-women-vintage-leather-coin-cell-phone-mobile-mini-cross-body-shoulder-bag-14251239.html%3Foffer_id%3D%7Boffer_id%7D%26affiliate_id%3D%7Baffiliate_id%7D%26offer_name%3D%7Boffer_name%7D_%7Boffer_file_id%7D%26affiliate_name%3D%7Baffiliate_name%7D%26transaction_id%3D%7Btransaction_id%7D&aff_sub=&aff_sub2=&aff_sub3=&aff_sub4=&aff_sub5=,2016-10-25T01:27:53Z
我在这里做错了什么?如何微调结果?
提前感谢您的帮助。
编辑(带有调试结果的xml结果):
查询: http:///solr//select?debugQuery=on&defType=edismax&indent=on&mm=3&ps=10&q=mobile&qf=category^10.0%20manu^10.0%20categorypath^5.0%20name^0.2&wt=xml
完整回复:
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">26</int>
<lst name="params">
<str name="mm">3</str>
<str name="q">mobile</str>
<str name="defType">edismax</str>
<str name="ps">10</str>
<str name="indent">on</str>
<str name="qf">category^10.0 manu^10.0 categorypath^5.0 name^0.2</str>
<str name="wt">xml</str>
<str name="debugQuery">on</str>
<str name="_">1477372296342</str>
</lst>
</lst>
<result name="response" numFound="12450223" start="0">
<doc>
<str name="description">This vertical case is made from PU leather material, and specially designed for your smartphone. The case features card slot and earphone hole for convenient use. It can be used as a shoulder bag or holster case. ? Made from PU material ? Come with two card slot ? Used as a shoulder bag and holster case ? Provides all-around protection</str>
<int name="discount_i">40</int>
<double name="mrp_d">990.0</double>
<str name="store">Flipkart</str>
<float name="price">490.0</float>
<str name="categorypath">Mobiles & Tablets|Mobile Accessories|Cases & Covers</str>
<str name="imageurl">http://img5a.flixcart.com/image/cases-covers/holster/h/c/x/jojo-jojo288086-400x400-imae822ffdyrhgmg.jpeg</str>
<str name="name">Jojo Holster for Fly Mobile MV 247</str>
<str name="id">ACCE9GQ3BMCHZXYY</str>
<str name="category">Cases & Covers</str>
<str name="manu">Jojo</str>
<str name="producturl">http://dl.flipkart.com/dl/jojo-holster-fly-mobile-mv-247/p/itme9gq44hz9dtjh?pid=ACCE9GQ3BMCHZXYY</str>
<date name="last_modified">2016-10-21T07:40:13Z</date>
<long name="_version_">1548784125563895810</long></doc>
<doc>
<str name="description">Mobile Cover Shop having numerous designs of exclusive range for mobile covers, back cover and protective cover and cases. Each cover is made from a special strong and durable plastic material, which provides your gadget with long lasting protection. We suggest you to keep this case in your collection for being in sync with latest trend in fashion.</str>
<int name="discount_i">50</int>
<double name="mrp_d">1200.0</double>
<str name="store">Flipkart</str>
<float name="price">599.0</float>
<str name="categorypath">Mobiles & Tablets|Mobile Accessories|Cases & Covers</str>
<str name="imageurl">http://img6a.flixcart.com/image/cases-covers/back-cover/p/k/e/mobile-cover-shop-mcs24354-400x400-imae8x3ydhwu6jrd.jpeg</str>
<str name="name">Mobile Cover Shop Back Cover for Lenovo K920</str>
<str name="id">ACCE8Y3U5HFZVPKE</str>
<str name="category">Cases & Covers</str>
<str name="manu">Mobile Cover Shop</str>
<str name="producturl">http://dl.flipkart.com/dl/mobile-cover-shop-back-lenovo-k920/p/itme8y3utmh9jzaa?pid=ACCE8Y3U5HFZVPKE</str>
<date name="last_modified">2016-10-21T07:40:13Z</date>
<long name="_version_">1548784125873225732</long></doc>
<doc>
<str name="description">Mobile Cover Shop having numerous designs of exclusive range for mobile covers, back cover and protective cover and cases. Each cover is made from a special strong and durable plastic material, which provides your gadget with long lasting protection. We suggest you to keep this case in your collection for being in sync with latest trend in fashion.</str>
<int name="discount_i">50</int>
<double name="mrp_d">1200.0</double>
<str name="store">Flipkart</str>
<float name="price">599.0</float>
<str name="categorypath">Mobiles & Tablets|Mobile Accessories|Cases & Covers</str>
<str name="imageurl">http://img6a.flixcart.com/image/cases-covers/back-cover/d/s/u/mobile-cover-shop-mcs23176-400x400-imae8p53hgwggnwb.jpeg</str>
<str name="name">Mobile Cover Shop Back Cover for Samsung Galaxy S5</str>
<str name="id">ACCE8Y3TJPXAFDSU</str>
<str name="category">Cases & Covers</str>
<str name="manu">Mobile Cover Shop</str>
<str name="producturl">http://dl.flipkart.com/dl/mobile-cover-shop-back-samsung-galaxy-s5/p/itme8y3tdjn4nqtj?pid=ACCE8Y3TJPXAFDSU</str>
<date name="last_modified">2016-10-21T07:40:14Z</date>
<long name="_version_">1548784126891393025</long></doc>
<doc>
<str name="description">Mobile Cover Shop having numerous designs of exclusive range for mobile covers, back cover and protective cover and cases. Each cover is made from a special strong and durable plastic material, which provides your gadget with long lasting protection. We suggest you to keep this case in your collection for being in sync with latest trend in fashion.</str>
<int name="discount_i">50</int>
<double name="mrp_d">1200.0</double>
<str name="store">Flipkart</str>
<float name="price">599.0</float>
<str name="categorypath">Mobiles & Tablets|Mobile Accessories|Cases & Covers</str>
<str name="imageurl">http://img5a.flixcart.com/image/cases-covers/back-cover/z/g/e/mobile-cover-shop-mcs23352-400x400-imae8p544uhatwtc.jpeg</str>
<str name="name">Mobile Cover Shop Back Cover for Samsung Galaxy Note 2 N7100</str>
<str name="id">ACCE8Y3TGHAK2ZGE</str>
<str name="category">Cases & Covers</str>
<str name="manu">Mobile Cover Shop</str>
<str name="producturl">http://dl.flipkart.com/dl/mobile-cover-shop-back-samsung-galaxy-note-2-n7100/p/itme8y3tcugyxmeb?pid=ACCE8Y3TGHAK2ZGE</str>
<date name="last_modified">2016-10-21T07:40:15Z</date>
<long name="_version_">1548784128432799747</long></doc>
<doc>
<str name="description">Mobile Cover Shop having numerous designs of exclusive range for mobile covers, back cover and protective cover and cases. Each cover is made from a special strong and durable plastic material, which provides your gadget with long lasting protection. We suggest you to keep this case in your collection for being in sync with latest trend in fashion.</str>
<int name="discount_i">50</int>
<double name="mrp_d">1200.0</double>
<str name="store">Flipkart</str>
<float name="price">599.0</float>
<str name="categorypath">Mobiles & Tablets|Mobile Accessories|Cases & Covers</str>
<str name="imageurl">http://img6a.flixcart.com/image/cases-covers/back-cover/x/3/q/mobile-cover-shop-mcs22843-400x400-imae8p53feah3b2q.jpeg</str>
<str name="name">Mobile Cover Shop Back Cover for Apple iPhone 6 Plus</str>
<str name="id">ACCE8Y3TM8YWHX3Q</str>
<str name="category">Cases & Covers</str>
<str name="manu">Mobile Cover Shop</str>
<str name="producturl">http://dl.flipkart.com/dl/mobile-cover-shop-back-apple-iphone-6-plus/p/itme8y3twsyngygp?pid=ACCE8Y3TM8YWHX3Q</str>
<date name="last_modified">2016-10-21T07:40:15Z</date>
<long name="_version_">1548784128862715904</long></doc>
</result>
<lst name="debug">
<str name="rawquerystring">mobile</str>
<str name="querystring">mobile</str>
<str name="parsedquery">(+DisjunctionMaxQuery(((manu:mobile)^10.0 | (name:mobile)^0.2 | (category:mobile)^10.0 | (categorypath:mobile)^5.0)))/no_coord</str>
<str name="parsedquery_toString">+((manu:mobile)^10.0 | (name:mobile)^0.2 | (category:mobile)^10.0 | (categorypath:mobile)^5.0)</str>
<lst name="explain">
<str name="ACCE9GQ3BMCHZXYY">
0.9692176 = max of:
0.9692176 = weight(name:mobile in 311) [], result of:
0.9692176 = score(doc=311,freq=1.0 = termFreq=1.0
), product of:
0.2 = boost
4.5229306 = idf(docFreq=177649, docCount=16362429)
1.0714487 = tfNorm, computed from:
1.0 = termFreq=1.0
1.2 = parameter k1
0.75 = parameter b
8.496009 = avgFieldLength
7.111111 = fieldLength
</str>
<str name="ACCE8Y3U5HFZVPKE">
62.168762 = max of:
62.168762 = weight(manu:mobile in 372) [], result of:
62.168762 = score(doc=372,freq=1.0 = termFreq=1.0
), product of:
10.0 = boost
6.216876 = idf(docFreq=32829, docCount=16452022)
1.0 = tfNorm, computed from:
1.0 = termFreq=1.0
1.2 = parameter k1
0.0 = parameter b (norms omitted for field)
0.8345084 = weight(name:mobile in 372) [], result of:
0.8345084 = score(doc=372,freq=1.0 = termFreq=1.0
), product of:
0.2 = boost
4.5229306 = idf(docFreq=177649, docCount=16362429)
0.92253065 = tfNorm, computed from:
1.0 = termFreq=1.0
1.2 = parameter k1
0.75 = parameter b
8.496009 = avgFieldLength
10.24 = fieldLength
</str>
<str name="ACCE8Y3TJPXAFDSU">
62.168762 = max of:
62.168762 = weight(manu:mobile in 570) [], result of:
62.168762 = score(doc=570,freq=1.0 = termFreq=1.0
), product of:
10.0 = boost
6.216876 = idf(docFreq=32829, docCount=16452022)
1.0 = tfNorm, computed from:
1.0 = termFreq=1.0
1.2 = parameter k1
0.0 = parameter b (norms omitted for field)
0.8345084 = weight(name:mobile in 570) [], result of:
0.8345084 = score(doc=570,freq=1.0 = termFreq=1.0
), product of:
0.2 = boost
4.5229306 = idf(docFreq=177649, docCount=16362429)
0.92253065 = tfNorm, computed from:
1.0 = termFreq=1.0
1.2 = parameter k1
0.75 = parameter b
8.496009 = avgFieldLength
10.24 = fieldLength
</str>
<str name="ACCE8Y3TGHAK2ZGE">
62.168762 = max of:
62.168762 = weight(manu:mobile in 819) [], result of:
62.168762 = score(doc=819,freq=1.0 = termFreq=1.0
), product of:
10.0 = boost
6.216876 = idf(docFreq=32829, docCount=16452022)
1.0 = tfNorm, computed from:
1.0 = termFreq=1.0
1.2 = parameter k1
0.0 = parameter b (norms omitted for field)
0.6644898 = weight(name:mobile in 819) [], result of:
0.6644898 = score(doc=819,freq=1.0 = termFreq=1.0
), product of:
0.2 = boost
4.5229306 = idf(docFreq=177649, docCount=16362429)
0.7345788 = tfNorm, computed from:
1.0 = termFreq=1.0
1.2 = parameter k1
0.75 = parameter b
8.496009 = avgFieldLength
16.0 = fieldLength
</str>
<str name="ACCE8Y3TM8YWHX3Q">
62.168762 = max of:
62.168762 = weight(manu:mobile in 886) [], result of:
62.168762 = score(doc=886,freq=1.0 = termFreq=1.0
), product of:
10.0 = boost
6.216876 = idf(docFreq=32829, docCount=16452022)
1.0 = tfNorm, computed from:
1.0 = termFreq=1.0
1.2 = parameter k1
0.0 = parameter b (norms omitted for field)
0.8345084 = weight(name:mobile in 886) [], result of:
0.8345084 = score(doc=886,freq=1.0 = termFreq=1.0
), product of:
0.2 = boost
4.5229306 = idf(docFreq=177649, docCount=16362429)
0.92253065 = tfNorm, computed from:
1.0 = termFreq=1.0
1.2 = parameter k1
0.75 = parameter b
8.496009 = avgFieldLength
10.24 = fieldLength
</str>
</lst>
<str name="QParser">ExtendedDismaxQParser</str>
<null name="altquerystring"/>
<null name="boost_queries"/>
<arr name="parsed_boost_queries"/>
<null name="boostfuncs"/>
<lst name="timing">
<double name="time">26.0</double>
<lst name="prepare">
<double name="time">0.0</double>
<lst name="query">
<double name="time">0.0</double>
</lst>
<lst name="facet">
<double name="time">0.0</double>
</lst>
<lst name="facet_module">
<double name="time">0.0</double>
</lst>
<lst name="mlt">
<double name="time">0.0</double>
</lst>
<lst name="highlight">
<double name="time">0.0</double>
</lst>
<lst name="stats">
<double name="time">0.0</double>
</lst>
<lst name="expand">
<double name="time">0.0</double>
</lst>
<lst name="debug">
<double name="time">0.0</double>
</lst>
</lst>
<lst name="process">
<double name="time">25.0</double>
<lst name="query">
<double name="time">0.0</double>
</lst>
<lst name="facet">
<double name="time">0.0</double>
</lst>
<lst name="facet_module">
<double name="time">0.0</double>
</lst>
<lst name="mlt">
<double name="time">0.0</double>
</lst>
<lst name="highlight">
<double name="time">0.0</double>
</lst>
<lst name="stats">
<double name="time">0.0</double>
</lst>
<lst name="expand">
<double name="time">0.0</double>
</lst>
<lst name="debug">
<double name="time">24.0</double>
</lst>
</lst>
</lst>
</lst>
</response>
【问题讨论】:
-
能否请您也为我发布结果集。我怀疑该查询也存在于您要提升十倍的类别中......但我需要查看结果来确认它。
-
感谢左撇子的评论。我编辑了问题并添加了结果。
-
为了让事情变得非常清楚,请您做两处更改:首先,在搜索 URL 中,您能否保留实际的关键字,以便我知道产生结果的内容。其次,您能否以 XML 格式发布结果,因为这里更容易阅读。谢谢。
-
我现在只搜索一个词 - “mobile”。我再次添加了带有完整响应的查询以及 xml 中的调试结果。我试图了解重量是如何计算的,但无法通过调试结果获得。