簡體   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