距離

2017-03-02 21 views
0

私のユースケース距離

私は検索機能で近くのお店を表示するようにコードを書いていますによってソートと検索語によって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' 
} 

を既存の私は、関連する結果を得ていないのですクエリの上に押すこと。

ドク構造:

{ 
    "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

空間クエリの場合、正しい結果を得るために空間フィルタを使用する必要があります。ドキュメントスコアとして距離を望む場合、qパラメータには{!func} geodist()が必要です。それ以外の場合は、fqでジオファイルパーサーを使用することもできます。

詳細情報についてはこちらを参照してください:https://cwiki.apache.org/confluence/display/solr/Spatial+Search

+0

感謝のお返事を、私はクエリでgeodist()を渡す場合は、検索語が行くところ、{FUNC!の}? –

+0

私の頭の上からq = _val_:mynumericfield _val _: "recip(rord(myfield)、1,2,3)" q pramの複数の問い合わせはこちらを参照してください。 https://wiki.apache.org/solr/SolrQuerySyntax – Yauza