django-haystack

AttributeError: 'ElasticSearch' object has no attribute 'bulk_index'\"

雨燕双飞 提交于 2019-12-02 04:55:08
When I try python manage.py rebuild_index , error occur: self.conn.bulk_index(self.index_name, 'modelresult', prepped_docs, id_field=ID) AttributeError: 'ElasticSearch' object has no attribute 'bulk_index' I found the link https://github.com/toastdriven/pyelasticsearch/blob/master/pyelasticsearch.py#L424-469 with pyelasticsearch.py, and I dont know which edition it is. Anyway there is bulk_index in that code, buy my pyelasticsearch.py is not. Anyone has the same experience? thanks for ur time. Plus: django-haystack 2.0.0.beta, pyelasticsearch 0.0.6 Django-haystack will NOT work with original

Django Haystack Distinct Value for Field

余生颓废 提交于 2019-12-02 03:48:20
I am building a small search engine using Django Haystack + Elasticsearch + Django REST Framework, and I'm trying to figure out reproduce the behavior of a Django QuerySet 's distinct method. My index looks something like this: class ItemIndex(indexes.SearchIndex, indexes.Indexable): text = indexes.CharField(document=True, use_template=True) item_id = indexes.IntegerField(faceted=True) def prepare_item_id(self, obj): return obj.item_id What I'd like to be able to do is the following: sqs = SearchQuerySet().filter(content=my_search_query).distinct('item_id') However, Haystack's SearchQuerySet

Django Haystack & Whoosh Search Working, But SearchQuerySet Return 0 Results

自古美人都是妖i 提交于 2019-12-01 08:54:45
问题 Edit: More info at bottom of post... Original Question: I seem to be having the same problem as in this (unresolved) question: django-haystack + Whoosh SearchQuerySet().all() always None I've set up Haystack with Whoosh on my Django project and all was working fine at first (SearchQuerySet used to return results), but after an aborted attempt to create a new custom search form (rolled back from git) it appears that indexing and the original search page still all work fine, but now

Failed to add documents to Solr: [Reason: Error 404 Not Found]

橙三吉。 提交于 2019-12-01 06:33:26
问题 I'm trying to index a model in Solr with django-haystack, but it returns me the following error(when using rebuild_index or update_index) : Failed to add documents to Solr: [Reason: Error 404 Not Found] This is search_indexes.py from haystack import indexes from haystack.indexes import SearchIndex from jobpost.models import * class JobIndex(indexes.SearchIndex, indexes.Indexable): text = indexes.CharField(document=True, use_template=True) post_type = indexes.CharField(model_attr='post_type')

Django: gettext raises ValueError: 'plural forms expression could be dangerous'

别来无恙 提交于 2019-11-30 21:02:10
If a auto generated django.po file contains the following line in its header "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" "manage.py runserver" raises gettext.py", line 93, in c2py raise ValueError, 'plural forms expression could be dangerous' ValueError: plural forms expression could be dangerous If i remove the line everything works. What does the header mean? Why is it somtimes generated (for example localisation of the haystack app)? What das the error message mean? It means that your translator forgot to fill it in properly . 来源: https://stackoverflow.com/questions/4935704

Can't get Elasticsearch working with Django

久未见 提交于 2019-11-30 16:02:30
I'm trying to use Django and Haystack with Elasticsearch as the backend on Ubuntu 14.04. I have Elasticsearch and Haystack installed. The error I receive when I run python manage.py runserver: me@ubuntu:$ python manage.py runserver Validating models... 0 errors found January 31, 2015 - 17:40:37 Django version 1.5.4, using settings 'website_project.settings' Development server is running at http://127.0.0.1:8000/ Quit the server with CONTROL-C. Traceback (most recent call last): File "/home/me/.pythonbrew/pythons/Python-2.7.5/lib/python2.7/wsgiref/handlers.py", line 85, in run self.result =

Can't build index for solr/haystack: unknown field 'django_id'

送分小仙女□ 提交于 2019-11-30 15:46:34
I'm trying to follow along the haystack tutorial. I run into an error when I run manage.py rebuild index I get the following error: WARNING: This will irreparably remove EVERYTHING from your search index. 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. /Users/heri0n/python_env/lib/python2.7/site-packages/django/db/models/fields/__init__.py:808: RuntimeWarning: DateTimeField received a naive datetime (2013-04-07 16:14:15

Haystack says “Model could not be found for SearchResult”

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 11:42:58
After updating my Django from 1.7 to 1.9, search engine, which is based on Haystack and Solr, stopped working. This is what I get: ./manage.py shell Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> from haystack.query import SearchQuerySet >>> sqs = SearchQuerySet().all() >>>sqs[0].pk u'1' >>> sqs[0].text u'\u06a9\u0627\u0645\u0631\u0627\u0646 \u0647\u0645\u062a\u200c\u067e\u0648\u0631 \u0648 \u0641\u0631\u0647\u0627\u062f \u0628\u0627\u062f\u067e\u0627\nKamran Hematpour & Farhad

Django Haystack : search for a term with and without accents

孤人 提交于 2019-11-30 10:06:42
I'm implementing a search system onto my django project, using django haystack. The problem is that some fields in my models have some french accents, and I would like to find the entries which contents the query with and without accents. I think the best Idea is to create a SearchIndex with both the fields with the accents, and the same field without the accents. Any idea or hint on this ? Here is some code Imagine the following models : Cars(models.Model): name = models.CharField() and the following Haystack Index: Cars(indexes.SearchIndex): name = indexes.CharField(model_attr='name')

haystack - how you display data from multiple models with ForeignKeys?

我的未来我决定 提交于 2019-11-30 09:32:13
I have two models: models.py class model1 (models.Model): field1_model1 = models.CharField() filed2_model1 = models.CharField() class model2 (models.Model): field1_model2 = models.ForeignKey(model1) field2_model2 = models.CharField() Using Haystack I want to do a text search based on the filed1_model1 but when I do that I want to show also filed2_model2 in the search results. What goes in the search_indexes.py and also in the search.html template files to make this happen? First you should add a related name to your foreign key so you can call it later. class Model2(models.Model): field1