Contentful :我可以使用 location [within] 查询参数来订购内容吗?
Contentful : Am I able to order content by using the location [within] query parameter?
所以我正在尝试根据给定半径内的 location/coordinates 检索条目。并且已经成功使用这个:
$query = new \Contentful\Delivery\Query;
$query->setContentType('store')
->where('fields.location[within]', '-37, 144, 50');
但是,它们的返回顺序并不是按照它们到给定半径中心的距离排序的。有什么帮助吗?谢谢
within
运算符不进行任何排序,这与 near
运算符不同。如果你试图在圆形区域的上下文中使用 within
,这似乎是你正在做的,你可以用 near
替换它,它应该按照你想要的方式工作:
fields.foo[near]=x,y,radius
radius
参数可以用来限制搜索区域。试一试,如果有帮助请告诉我!
大卫
所以我正在尝试根据给定半径内的 location/coordinates 检索条目。并且已经成功使用这个:
$query = new \Contentful\Delivery\Query;
$query->setContentType('store')
->where('fields.location[within]', '-37, 144, 50');
但是,它们的返回顺序并不是按照它们到给定半径中心的距离排序的。有什么帮助吗?谢谢
within
运算符不进行任何排序,这与 near
运算符不同。如果你试图在圆形区域的上下文中使用 within
,这似乎是你正在做的,你可以用 near
替换它,它应该按照你想要的方式工作:
fields.foo[near]=x,y,radius
radius
参数可以用来限制搜索区域。试一试,如果有帮助请告诉我!
大卫