can't get partial word search to work with haystack/elasticsearch -
I'm trying to work partial word and I've already seen but for some reason I do not have setup work. I am using a heap of elastic search with somebody can tell me what I am doing wrong.
EDIT: I have done this work using AutoComplete. However, I think this is a hack. But here's my code:
class VendorIndex (indexes.SearchIndex, indexes.Indexable): text = indexes.CharField (document = true, use_template = true) company_name = indexes.CharField (model_attr = Get_model (self): return seller def index_queryset (self, using = none): "" "when the entire index for the model Is used to update. "" "Return to self .get_model (). Objects.all () In the scene then:
class SearchVendorView (generics.ListAPIView): serializer_class = serializers.CustomerVendorSerializer def get_queryset (self):. Results = SearchQuerySet () Model (vendor) .autocomplete (company_name_auto = self.request.GET.get ('Q', '')) vendors = [] resultor.object result for seller [result]: vendor.is_liked = Vendor .objects.from_request (self.request) .get (pk = vendor.id) .user_vote v Endors.append return vendors
In my case: django-Haystack == 2.5.1 + elasticsearch == 5.0.1 + Java elastic search daemon v2.3.1 is sufficient to obtain partial search:
and then Python manage.py rebuild_index and you can be searched by:
P> div>
Comments
Post a Comment