Hi, I am using Django-Haystack which connects Django with Solr. I have a model called Item which is about webpages. I want to enable personalized search so that users can search only the items they have shared. I solved the problem like this:
sqs = searchqueryset.auto_query(query).filter(primary_key__in=own_items_ids) own_item_ids is a list of integers that I got from Django ORM. primary_key is just the primary key of the Item model. My questions is, By observing the actual query in Solr, there are lots of OR(like item_id=1 OR item_id=2 ...) So I guess the time complexity is O(n^2), but I want to reduce it to O(n). I want to build a hash table of own_item_ids, and query this hash table while scanning the results linearly so that I can get the filtered results. Is this possible, if yes, how? I have passed this question to Haystack maillist, but the author said he doesn't know about the underlying mechanism. Thanks! Yifu