簡體   English   中英

Cloudsearch邊界框過濾器

[英]Cloudsearch bounding box filter

我有以下CloudSearch查詢

$query = array(
'query' => '(and expiry:[' . $time . ',} updatetime:[100,} type:\'all\')',
'queryParser' => 'structured',
'queryOptions' => '{"defaultOperator":"and"}',
'sort' => 'distance asc',
'return'=>'_all_fields,_score,distance',
'size' => 5000,
'expr'=> '{"distance":"haversin(' . $lat . ',' . $lon . ',location.latitude,location.longitude)"}',
'start'=>$start,
'fq'=>'location:[\'35.628611,-120.694152\',\'35.621966,-120.686706\']'

);

查詢除FQ部分外,其意圖是fq會將結果限制在邊界框區域內。 但盡管有它,但它並沒有限制結果。 遠遠超出該區域的結果正在返回,我需要更改此內容才能使其正常工作?

我有解決這個問題的方法

盡管aws文檔在示例中將其稱為fq,但它實際上是filterQuery

另請注意,位置點順序是左上角,右下角

$query = array(
'query' => '(and expiry:[' . $time . ',} updatetime:[100,} type:\'all\')',
'queryParser' => 'structured',
'queryOptions' => '{"defaultOperator":"and"}',
'sort' => 'distance asc',
'return'=>'_all_fields,_score,distance',
'size' => 5000,
'expr'=> '{"distance":"haversin(' . $lat . ',' . $lon .          ',location.latitude,location.longitude)"}',
'start'=>$start,
'filterQuery'=>'location:[\'35.628611,-120.694152\',\'35.621966,-120.686706\']'

 );

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM