Avatar ·

django + haystack + Whoosh में सबस्ट्रिंग खोज

📁 पायथन, काम

एक मॉडल है। इसमें फिल्मों के नाम संग्रहीत हैं। यहाँ इंडेक्स क्लास है:

from haystack import indexesfrom kino.films.models import Filmsclass FilmsIndex(indexes.SearchIndex, indexes.Indexable):    text = indexes.CharField(document=True, use_template=True)    rusname = indexes.CharField(model_attr='rusname')    origname = indexes.CharField(model_attr='origname')    year = indexes.IntegerField(model_attr='year')    def get_model(self):        retu Films

इंडेक्स बनता है और लगभग सब काम करता है, लेकिन बिल्कुल वैसा नहीं जैसा चाहिए। इस प्रकार का क्वेरी:

SearchQuerySe