我的用例
我正在编写代码以显示附近具有搜索功能的商店。我想根据给定的用例从solr中取出商店 - 如果我搜索术语:" allen so",所有附近的商店都以期限开始" allen so"应该先来。最近的商店应该出现。*
现有查询
{
q: 'allen so*',
defType: 'edismax',
pt: '28.4836556,77.1074802',
qf: 'shop_name^4 cat^3 sub_cat^2',
fl: '*,distance:geodist()',
start: '0',
sort: 'geodist() asc',
rows: '20',
sfield: 'shop_loc',
wt: 'json'
}
通过点击上述查询我没有得到相关结果。
Doc结构:
{
"shop_id": "1",
"shop_name": "Allen Solly",
"shop_nickname": "Allen Solly",
"shop_summary": "A search of the AAAC archives yields little about Allen Solly suits except the fact that they were sold about fifty years ago. These days they appear to be mainly a woman's brand, mainly focussed only on casual or business casual clothes, and mainly popular in India. Yet the label says \"Established 1744 / Nottingham, England.\"",
"shop_description": "A search of the AAAC archives yields little about Allen Solly suits except the fact that they were sold about fifty years ago. These days they appear to be mainly a woman's brand, mainly focussed only on casual or business casual clothes, and mainly popular in India. Yet the label says \"Established 1744 / Nottingham, England.\"",
"shop_address_1": "MGF Metropolitan Mall, MG Rd, Heritage City, Sector 25, Gurugram, Haryana 122002",
"shop_address_2": "Gurgaon, Haryana, India",
"shop_city": "Gurgaon",
"shop_state": "Haryana",
"shop_country": "India",
"shop_area_code": "122002",
"shop_opening_time": "11:00:00",
"shop_closing_time": "19:00:00",
"shop_working_days": "Sunday Monday Tuesday Wednesday Thursday Friday Saturday",
"currency": "INR",
"active": true,
"user_id": "4",
"created_at": "2016-11-29T10:07:17Z",
"updated_at": "2016-11-29T10:07:20Z",
"cat": [
"Clothing & Accessories"
],
"sub_cat": [
"mens casual shirts",
"mens sweater"
],
"shop_loc": "28.480853965280254,77.08022397011518"
}
请帮助我,我被严重困扰!!
答案 0 :(得分:0)
对于空间查询,您必须使用空间过滤器来获得正确的结果。如果您希望距离作为文档分数,则q参数需要具有{!func} geodist()。否则你可以在fq中使用geofilt解析器。
有关详细信息,请参阅此处:https://cwiki.apache.org/confluence/display/solr/Spatial+Search