I am trying to add boost into my haystack search but sadly not able to. This is my search_indexes.py.
class feedIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.EdgeNgramField(document=True, use_template=True)
feed_text = indexes.EdgeNgramField(model_attr='feed_text',null=True)
tags = indexes.CharField(model_attr='tags')
def get_model(self):
return Feed
def prepare_feed_text(self, obj):
return "Feed"
def prepare(self, obj):
data = super(feedIndex, self).prepare(obj)
data['boost'] = 1.5
return data
What else i need to add. Because this i found only this in tutorial. When i run rebult_index i am able to see the boost associated with field in http://localhost:9200/_search .
My search backend is elasticsearch. I have gone through all questions related to this but didnt find useful for me.
Try using data["_boost"]. I forget how/why this works for us unfortunately.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With