django-haystack

How do I do a partial field match using Haystack?

廉价感情. 提交于 2019-12-28 16:40:59
问题 I needed a simple search tool for my django-powered web site, so I went with Haystack and Solr. I have set everything up correctly and can find the correct search results when I type in the exact phrase, but I can't get any results when typing in a partial phrase. For example: "John" returns "John Doe" but "Joh" doesn't return anything. Model: class Person(models.Model): first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) Search Index: class PersonIndex

Django + Haystack + Whoosh, no results in production

耗尽温柔 提交于 2019-12-25 04:04:00
问题 I'm building a Django application using Haystack+Whoosh for search. In the development environment, search works as expected. However, in production, searches consistently return no results. Development: $> python manage.py rebuild_index ... All documents removed. Indexing 8 categories Indexing 4 documents $> python manage.py shell ... >>> from haystack.query import SearchQuerySet >>> SearchQuerySet().all().count() 12 Production: $> dokku run proj python manage.py rebuild_index -v2 ... All

Unable to search '#' in elasticsearch

可紊 提交于 2019-12-25 04:01:23
问题 This query - curl -XGET http://localhost:9200/haystack/modelresult/_search?q=post_text:#test fails to execute with an error SearchPhaseExecutionException[Failed to execute phase with status 400 回答1: Try this: curl -XPOST "http://localhost:9200/haystack/modelresult/_search" -d' { "query": { "match": { "post_text": "#test" } } }' or this: curl -XPOST "http://localhost:9200/haystack/modelresult/_search" -d' { "query": { "term": { "post_text": "#test" } } }' 来源: https://stackoverflow.com

Unable to search '#' in elasticsearch

蓝咒 提交于 2019-12-25 04:01:09
问题 This query - curl -XGET http://localhost:9200/haystack/modelresult/_search?q=post_text:#test fails to execute with an error SearchPhaseExecutionException[Failed to execute phase with status 400 回答1: Try this: curl -XPOST "http://localhost:9200/haystack/modelresult/_search" -d' { "query": { "match": { "post_text": "#test" } } }' or this: curl -XPOST "http://localhost:9200/haystack/modelresult/_search" -d' { "query": { "term": { "post_text": "#test" } } }' 来源: https://stackoverflow.com

haystack elasticsearch RealtimeSignalProcessor updates only “default” connection

﹥>﹥吖頭↗ 提交于 2019-12-24 14:43:26
问题 I have 3 search indexes and 3 haystack connections. I want the indexes to be updated in real time so I use RealtimeSignalProcessor. It is working only for 1 of the 3 connections ("default") but it does not work when I search for the term using the other 2 connections. Than I have to do python manage.py update_index manually to make it work.. How can this be fixed without updating the index manually? HAYSTACK_CONNECTIONS = { 'default': { 'ENGINE': 'haystack.backends.elasticsearch_backend

show price and rating in facet search

北慕城南 提交于 2019-12-24 14:42:58
问题 I want to show rating and price range in facet search however the rating is not displayed and price range is displayed but is disabled. What else should i have to do to show them in facet search? This is the source code of django-oscar. Here is the configuration FURNITURE_SEARCH_FACETS = { 'fields': OrderedDict([ ('product_class', {'name': _('Type'), 'field': 'product_class'}), ('rating', {'name': _('Rating'), 'field': 'rating'}), ]), 'queries': OrderedDict([ ('price_range', { 'name': _(

haystack elasticsearch RealtimeSignalProcessor updates only “default” connection

萝らか妹 提交于 2019-12-24 14:32:05
问题 I have 3 search indexes and 3 haystack connections. I want the indexes to be updated in real time so I use RealtimeSignalProcessor. It is working only for 1 of the 3 connections ("default") but it does not work when I search for the term using the other 2 connections. Than I have to do python manage.py update_index manually to make it work.. How can this be fixed without updating the index manually? HAYSTACK_CONNECTIONS = { 'default': { 'ENGINE': 'haystack.backends.elasticsearch_backend

Haystack's SearchQuerySet().filter not doing anything (Whoosh 2.4.1, Django-haystack 1.2.7)

强颜欢笑 提交于 2019-12-24 12:51:26
问题 views.py (relevant part) srch = request.GET.get('search', "") sqs = SearchQuerySet().filter(has_title=True) clean_query = sqs.query.clean(srch) results = sqs.raw_search(clean_query) search_indexes.py from haystack.indexes import * from haystack import site from myproject.myapp.models import Person class PersonIndex(SearchIndex): text = CharField(document=True, use_template=True) name = CharField(model_attr='name') has_title = BooleanField(model_attr='has_title') site.register(Person,

Filter haystack result with SearchQuerySet

≡放荡痞女 提交于 2019-12-24 09:53:11
问题 I'm using haystack with whoosh, trying to restrict search results to entries created by the currently logged in user only. The category model, for which I created an index, has a foreign key: user = models.ForeignKey(User, editable=False) And in my custom search view I want to filter like this: searchqueryset = SearchQuerySet().filter(user=request.user.id) form = SearchForm(request.GET, searchqueryset=searchqueryset, load_all=True) if form.is_valid(): query = form.cleaned_data['q'] results =

Trying to install django-haystack

放肆的年华 提交于 2019-12-24 09:36:50
问题 Hello I'm trying to install django-haystack on a Debian 7 x86 but it is impossible to install, this Debian is fresh installation, I compiled python 3.6, I am little disappointed, this the error I get 100% |ââââââââââââââââââââââââââââââââ| 389kB 9.0kB/s Complete output from command python setup.py egg_info: Download error on https://pypi.python.org/simple/setuptools_scm/: [Errno -2] Name or service not known -- Some packages may not be found! Download error on https://pypi.python.org/simple