繁体   English   中英

django-haystack空间搜索需求?

[英]django-haystack spatial search requirements?

我正尝试使用django-haystack进行地理空间查询,如下所述: http : //django-haystack.readthedocs.org/en/latest/spatial.html我正在使用Elasticsearch作为后端。 我根据文档创建了search_indexes,配置了django,当我第一次尝试使用rebuild_index管理命令时,我看到了一个错误:

python manage.py rebuild_index --settings=myproject.settings.local

WARNING: This will irreparably remove EVERYTHING from your search index in connection 'default'.
Your choices after this are to restore from backups or rebuild via the `rebuild_index` command.
Are you sure you wish to continue? [y/N] y
Removing all documents from your index because you said so.
All documents removed.
Indexing 1 Venues
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  ...
  ...
  File "/f/venvs/myproject/local/lib/python2.7/site-packages/haystack/backends/elasticsearch_backend.py", line 161, in update
    prepped_data = index.full_prepare(obj)
  File "/f/venvs/myproject/local/lib/python2.7/site-packages/haystack/indexes.py", line 204, in full_prepare
    self.prepared_data = self.prepare(obj)
  File "/f/venvs/myproject/local/lib/python2.7/site-packages/haystack/indexes.py", line 195, in prepare
    self.prepared_data[field.index_fieldname] = field.prepare(obj)
  File "/f/venvs/myproject/local/lib/python2.7/site-packages/haystack/fields.py", line 167, in prepare
    from haystack.utils.geo import ensure_point
  File "/f/venvs/myproject/local/lib/python2.7/site-packages/haystack/utils/geo.py", line 2, in <module>
    from django.contrib.gis.geos import Point
ImportError: cannot import name Point

干草堆用于从django.contrib.gis.geos进行空间搜索的点无法导入,我不确定为什么。 在干草堆中进行空间搜索是否需要完整运行的django.contrib.gis(geodjango)? 换句话说:我是否必须为geodjango安装所有c库,配置postgis,然后才能在干草堆中使用Point类?

软件版本:

  • Django 1.6
  • django-干草堆2.1.0
  • pyelasticsearch 0.6.1
  • 弹性搜索0.90.7

我通过安装libgeos和libgeos-dev解​​决了问题

sudo apt-get install libgeos-dev

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM