python - Django-haystack - how to make only a subset of items be searchable? -


I have some items that I'm indexing with Django-Haystack (elasticsearch backend) to be searched. It works fine, but the users are able to like the item, and I want users to do their favorite searches as they can find all the items. Relationships are presented with many people with a lot of favorites, because I need time when a user likes an item. Is there any way to specifically search users? I do not want to create a separate index for each user's favorites, because they will be at least because the item is identical and is already indexed by the master index. For reference, my models and search index look like:

  class gallery (models.Model): faves = models.ManyToManyField (user, through = 'favorite', tap = true, Related_name = "faves") class favorites (models.model): user = models.ForeignKey (user) gallery = model. Fargin (Gallery) Date = Model.Defhed (auto_now_add = true) class meta: order [= "date"] class   

thanks

You want to see related searchquantets (), though there is a lot to read about the warning effect on the page about the effect of the effect; I tried to do it and it was slower than most questions.

If you want something like this: jango.contrib.auth.models Import user from a heap of grass. Some import related circuitsetset. Models Import Gallery U = User.obies.jet (...) sqs = related searchcatset (). load_all () sqs = sqs.load_all_queryset (gallery, u.faves.all ())

This should give you only one user's favorite search search device, which you can filter further by searching Can.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -