Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is annotation possible? #272

Open
Brechard opened this issue Sep 10, 2021 · 0 comments
Open

Is annotation possible? #272

Brechard opened this issue Sep 10, 2021 · 0 comments
Labels

Comments

@Brechard
Copy link

Hi!

I have made a search engine for my django backend using plain django filtering but I would like to boost it using ElasticSearch and here I found myself. I actually have several questions since it is the first time I do something similar.

For now I have implemented the search with fuzziness and it is working great but I would like to annotate the results with the reviews that the items have received, how can I do that? I already have the annotation working with the django filter functions, I just want to now use it with elasticsearch.

The review model is fairly simple:

class ItemReview(models.Model):
    book = models.ForeignKey('books.book', on_delete=models.CASCADE, related_name='item_review')
    from_user = models.ForeignKey(UserProfile, on_delete=models.SET_NULL, null=True, related_name='item_from_user_review')
    rating = models.DecimalField(decimal_places=2, max_digits=3)
    review = models.TextField()
    created_at = models.DateTimeField(auto_now_add=True, editable=False)

also my book object has some fields that are not used for the search but are needed later on front-end, should I still put them on the Document file? Since if I do not, then I get a serializer error.

Got AttributeError when attempting to get a value for field `status` on serializer `BookAllBasicsSerializer`.
The serializer field might be named incorrectly and not match any attribute or key on the `Hit` instance.
Original exception text was: 'Hit' object has no attribute 'status'.

Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant