django-haystack

haystack.exceptions.SearchBackendError: No fields were found in any search_indexes. Please correct this before attempting to search

北战南征 提交于 2019-12-12 10:48:50
问题 I am trying to implement Haystack with whoosh. I keep getting this error although everything seems to be configured fine. I get the error: haystack.exceptions.SearchBackendError: No fields were found in any search_indexes. Please correct this before attempting to search. ...when I try to do ./manage.py rebuild_index configuration: HAYSTACK_SITECONF = 'myproject' HAYSTACK_SEARCH_ENGINE = 'whoosh' HAYSTACK_WHOOSH_PATH = cwd + '/whoosh/mysite_index' There are successfully created whoosh/mysite

Using django haystack autocomplete with elasticsearch to search for digits/numbers?

雨燕双飞 提交于 2019-12-12 09:51:42
问题 I'm using Django Haystack backed by Elasticsearch for autocomplete, and I'm having trouble searching for digits in a field. For example, I have a field called 'name' on an object type that has some values like this: ['NAME', 'NAME2', 'NAME7', 'ANOTHER NAME 8', '7342', 'SOMETHING ELSE', 'LAST ONE 7'] and I'd like to use autocomplete to search for all objects with the number '7' in the name. I've set up my search_index with this field: name_auto = indexes.EdgeNgramField(model_attr='name') and I

Error: The 'elasticsearch' backend requires the installation of 'requests'. How do I fix it?

空扰寡人 提交于 2019-12-12 08:49:16
问题 I´m having a issue when I ran "python manage.py rebuild_index" in my app supported by haystack and elasticsearch. Python 2.7 Django version 1.6.2 Haystack 2.1.0 Elasticsearch 1.0 Please see the error that is appearing: Traceback (most recent call last): File "manage.py", line 10, in execute_from_command_line(sys.argv) File "/usr/lib/python2.7/site-packages/django/core/management/ init .py", line 399, in > execute_from_command_line utility.execute() File "/usr/lib/python2.7/site-packages

how to filter search by values that are not available

十年热恋 提交于 2019-12-12 08:28:57
问题 I have a list of items as: i = SearchQuerySet().models(Item) now, each item in i has a attribute, price I want to narrow the result in which price information is not available along with the ones falling in a given range something like i.narrow('price:( None OR [300 TO 400 ] )') how can that be done? 回答1: Try this: -(-price:[300 TO 400] AND price:[* TO *]) is logically the same and it works in Solr. 回答2: As per the SolrQuerySyntax Pure Negative Queries: -field:[* TO *] finds all documents

Django Haystack and Taggit

蓝咒 提交于 2019-12-12 08:14:15
问题 Is there anybody using Django taggit with haystack? How can we make tags field indexable by haystack? I have tried: class EventIndex(indexes.SearchIndex, indexes.Indexable): text = indexes.CharField( model_attr='descr_en', document=True, use_template=True) text_tr = indexes.CharField(model_attr='descr_tr') tags = indexes.MultiValueField() def prepare_text(self, obj): return '%s %s' % (obj.title_en, obj.descr_en) def prepare_text_tr(self, obj): return '%s %s' % (obj.title_tr, obj.descr_tr) def

Give less weight to term frequency in solr?

此生再无相见时 提交于 2019-12-12 04:48:02
问题 How do I change the scoring function of Solr to give less weight to "term frequency"? I am using a pagerank-like document boost as a relevancy factor. My search index currently puts many documents that are "spammy" or not well-cleaned up and have repetitive words on top. I know the score is calculated by term frequency (how often a search term is in the document), inverse document frequency, and others (How are documents scored?). I could just increase the boost, but that would disemphasize

NgramField returning resutls based on substring of the query term

怎甘沉沦 提交于 2019-12-12 03:47:37
问题 I have a Warehouse Model which is getting index as follows class WarehouseIndex(SearchIndex, Indexable): """ SearchIndex Class that stored indexes for Model Warehouse """ text = CharField(document=True, use_template=True) search_auto = NgramField() .... def get_model(self): return WareHouse In my shell I am running the following sqs query. >>> sqs = SearchQuerySet().models(WareHouse) >>> sqs.filter(customers=3).filter(search_auto='pondicherry') This returns result consisting of results that

Phrase Search using Elasticsearch Showing Unrelated Results

痴心易碎 提交于 2019-12-12 03:16:29
问题 I'm using Elasticsearch 1.4.1 on an Ubuntu Linux machine to provide search for a Django 1.5 site, using Haystack 2.3.1. I have my search indexes set up using EdgeNGram fields for the document text, and other than some filtering of the searchqueryset in the SearchView, I have a pretty standard setup (I think :) ). What I'm having an issue with is that phrase searches (quoted searches) are working fine, except for some certain cases, for example: "1G chicken" (just made up, but exemplifies the

django-haystack autocomplete returns too wide results

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 01:57:26
问题 I have created an Index with field title_auto : class GameIndex(indexes.SearchIndex, indexes.Indexable): text = indexes.CharField(document=True, model_attr='title') title = indexes.CharField(model_attr='title') title_auto = indexes.NgramField(model_attr='title') Elastic search settings look like this: ELASTICSEARCH_INDEX_SETTINGS = { 'settings': { "analysis": { "analyzer": { "ngram_analyzer": { "type": "custom", "tokenizer": "lowercase", "filter": ["haystack_ngram"], "token_chars": ["letter",

Django-Haystack Search based on multiple index fields

二次信任 提交于 2019-12-11 23:50:36
问题 I am quite a newbbie with django-haystack. Following documentation and tutorials I was able to create a search App based on document content (DataBase SQLITE). As next step, I have updated my HTML template to request for more info (e.g.: Model, desired DB link, etc.) I do not know how to approach this. Below the files I am using. My knowledge is still quite basic, so any help would be very much appreciated. Thanks. search.html {% extends 'base.html' %} {% block content %} <h2> Doc Search