Sunday 15 February 2015

How to create indexes from two django apps in Haystack? -


How to implement my messy search in working on a degena app but on two different apps < P> Do I have different search_index.py try.Created in both apps Imported Datetime import APP1 class app1Index (indexes.SearchIndex, indexes.Indexable): imported stack of straw from APP1

  app1.models: text = indexes.EdgeNgramField (document = true, Use_template = true) app1_text = indexes.CharField (model_attr = 'app1_text', null = true) tag = indexes.CharField (model_attr = 'tags') def get_model (auto): return APP1   

App2

True) app2_title = indexes.charfield (model_attr = 'app2_title', null = true) def get_model ( Wyn): Return App2

This search.html is

  {% result in page.object_list%} & lt; P & gt; & Lt; A href = "{{result.object.get_absolute_url}}" & gt; {{Result.object.wish_text}} & lt; / A & gt; & Lt; A href = "{{result.object.get_absolute_url}}" & gt; {{Result.object.title}} & lt; / A & gt; & Lt; / P & gt;   

I have a data template for both apps at the right place. APP1 {{object.app1_text}} {{App2 object.app2_title}}

I have the App2 search_index It's working fine for APP1 not using

Q: How can I work for both apps?

Well I am not able to understand the problem completely, which you talk about If so, as far as I understand, the index works, which means the app (1 | 2) index detects the appropriate template. This can be a URL issue of app 2. The template may be of interest for further investigation

No comments:

Post a Comment