You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by homerlex <ho...@gmail.com> on 2010/06/04 13:56:39 UTC

MultiValue Exclusion

How would you model this?

We have a table of news items that people can view in their news stream and
comment on.  Users have the ability to "mute" item so they never see them in
their feed or search results.

>From what I can see there are a couple ways to accomplish this.

1 - Post process the results and do not render any muted news items.  The
downside of the pagination become problematic.  Its possible we may forgo
pagination because of this but for now assume that pagination is a
requirement.

2 - Whenever we query for a given user we append a clause that excludes all
muted items.  I assume in Solr we'd need to do something like -item_id(1 AND
2 AND 3).  Obviously this doesn't scale very well.

3 - Have a multi-valued property in the index that contains all ids of users
who have muted the item.  Being new to Solr I don't even know how (or if its
possible) to run a query that says "user id not this multivalued property". 
Can this even be done (sample query please)?  Again, I know this doesn't
scale very well.

Any other suggestions?

Thanks in advance for the help.
-- 
View this message in context: http://lucene.472066.n3.nabble.com/MultiValue-Exclusion-tp870173p870173.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: MultiValue Exclusion

Posted by Geert-Jan Brits <gb...@gmail.com>.
I guess the following works.

A. similar to your option 2, but using the filtercache
fq=-item_id:001 -item_id:002

B. similar to your option 3, but using the filtercache
fq=-users_excluded_field:<userid>

the advantage being that the filter is cached independently from the rest of
the query so it can be reused efficiently.

adv A over B. the 'muted news items' can be queried dynamically, i.e: they
aren't set in stone at index time.
B will probably perform a little bit better the first time (when nog
cached), but I'm not sure.

hope that helps,
Geert-Jan


2010/6/4 homerlex <ho...@gmail.com>

>
> How would you model this?
>
> We have a table of news items that people can view in their news stream and
> comment on.  Users have the ability to "mute" item so they never see them
> in
> their feed or search results.
>
> From what I can see there are a couple ways to accomplish this.
>
> 1 - Post process the results and do not render any muted news items.  The
> downside of the pagination become problematic.  Its possible we may forgo
> pagination because of this but for now assume that pagination is a
> requirement.
>
> 2 - Whenever we query for a given user we append a clause that excludes all
> muted items.  I assume in Solr we'd need to do something like -item_id(1
> AND
> 2 AND 3).  Obviously this doesn't scale very well.
>
> 3 - Have a multi-valued property in the index that contains all ids of
> users
> who have muted the item.  Being new to Solr I don't even know how (or if
> its
> possible) to run a query that says "user id not this multivalued property".
> Can this even be done (sample query please)?  Again, I know this doesn't
> scale very well.
>
> Any other suggestions?
>
> Thanks in advance for the help.
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/MultiValue-Exclusion-tp870173p870173.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>