Rails 3.x 中使用 Solr (websolr) 进行地理空间搜索
我希望在 Rails 3.1 应用程序中利用 Solr 进行文本和地理空间搜索。我看到 websolr 支持地理空间索引和搜索但有两个宝石(sunspot & rsolr) 似乎(当前)没有实现它。 Sunspot 似乎正在添加该功能,但声称“[地理空间] 处于实验阶段且尚未发布。DSL 可能会发生变化。”
是否有其他使用 sunspot + websolr 进行地理空间搜索的实现?我做了一些搜索并遇到了一些,但它们看起来很老套,如果已经有核心功能或更受支持的方法,我宁愿不使用我发现的东西。
I am looking to utilize Solr for both text and geospatial searching in a Rails 3.1 app. I see that websolr supports geo-spatial indexing & searches but the two gems for it (sunspot & rsolr) do not seem to (currently) implement it. Sunspot appears to be in the process of adding the functionality but claims that "[geospatial is] experimental and unreleased. The DSL may change."
Are there other implementations of geospatial searching with sunspot + websolr? I've done a bit of googing and come across some but they seem hackish and I'd rather not use what I've found if there is already a core feature being baked in or a more supported approach.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Sunspot 确实支持地理空间搜索,但有一些限制。
索引:
搜索:
但它确实不精确......如果我没记错的话,它使用地理哈希。因此,有可能有 2 个点彼此很接近,但没有找到。
另外,您不能在构面
附近
嵌套。我会遵循 ADAM 的建议并进行弹性搜索。我就是这么做的。你可以获得更多的控制权。
Tire 还支持地理空间搜索,但 DSL 中没有具体方法,因为不需要。我想他们计划稍后添加。
索引:
搜索:
Sunspot does support geo-spatial search, with some limitations.
Indexing:
Search:
But it's really not precise... It's using geo hashes if I'm not mistaken. So it's possible that 2 points are close from each other but are not found.
Also, you can't nest
near
in facets.I would follow the advice of ADAM and go for elastic search. That's what I did. You get a lot more control.
Tire also supports geospatial search, but there is no specific methods in the DSL, because it's not needed. They plan to add them later I think.
Indexing:
Search:
对于后代:Sunspot 已发布版本 1.3.0,支持 Solr 3 空间搜索,使其成为 Heroku 上与 Websolr 完美可行的选项。
For posterity: Sunspot has since released version 1.3.0 with support for Solr 3 spatial search, making it a perfectly viable option on Heroku with Websolr.