Issue 406 in simile-widgets: Add setting that makes Listfacet combine its selection as AND instead of OR.

49 views
Skip to first unread message

codesite...@google.com

unread,
Oct 24, 2010, 5:57:30 AM10/24/10
to simile-wi...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 406 by m.d.na...@hetnet.nl: Add setting that makes Listfacet
combine its selection as AND instead of OR.
http://code.google.com/p/simile-widgets/issues/detail?id=406

There are several requests on the mailing list for a list facet that
returns those items that have all of the chosen options in the list facet
instead of any one of the chosen options as is the case with the present
implementation (trunk revision 2140). I tried to implement this and the
result is in the attached file "andListfacet.js".

If this file is loaded after the exhibit code is loaded, it adds an extra
setting with the name "combineMode" to listfacets. The default of this
setting is "or" which keeps the current behavior. If combineMode is set
to "and" the facet is to behave in the requested manner. So code within
your exhibit html file typically looks like:
<div ex:role="facet" ex:expression=".property" ex:combineMode="and"></div>

Please give this code a try, and report positive and negative results here
on the issue tracker, because it has not seen much testing.


Attachments:
andListfacet.js 8.9 KB

codesite...@google.com

unread,
Oct 25, 2010, 6:06:54 AM10/25/10
to simile-wi...@googlegroups.com

Comment #1 on issue 406 by kumar.chalasani: Add setting that makes
Listfacet combine its selection as AND instead of OR.
http://code.google.com/p/simile-widgets/issues/detail?id=406

hi Michiel, this is a great addition - i've needed this for a long time.
i just tried it, and it seems to work just fine.
thank you!


codesite...@google.com

unread,
Dec 22, 2010, 5:37:28 PM12/22/10
to simile-wi...@googlegroups.com

Comment #2 on issue 406 by russelljryan: Add setting that makes Listfacet
combine its selection as AND instead of OR.
http://code.google.com/p/simile-widgets/issues/detail?id=406

Hey Michiel,

I tried out your patch and it works well. The only problem I see is that
the counts and available items within a single list-facet are not updated
to reflect the fact that the facet intersects versus unions. For my
use-case, it's useful to see the number of items that would result by
selecting an additional restriction in the list facet.

The counts are updated when the Exhibit.ListFacet.update is called. It's
called with the set of items that are available to the facet -- if this
list-facet is the only one with restrictions, it updates it with the all
the available items. If it is not the only one, then it is updated with the
intersection of all available items from the other facets. The logic for
all this is in Exhibit.Collection._updateFacets.

To fix the counts for the intersect case, on a ListFacet.update(), I just
called restrict() on the set of items given before calculating the counts
if the list-facet is in intersection mode. This makes the counts limited
only to values arising from items in the intersection of the currently
chosen restrictions.

The attached patch to andListfacet.js accomplishes this. It's a straight
copy of Exhibit.ListFacet.prototype._computeFacet from SVN r2153, except
lines 3-7 of the method are the restrict() call I describe above. It works
well for me.


Thanks,
RJ Ryan

Attachments:
intersectionCounts.patch 1.9 KB

codesite...@google.com

unread,
Feb 5, 2011, 3:22:08 PM2/5/11
to simile-wi...@googlegroups.com

Comment #3 on issue 406 by pleon...@gmail.com: Add setting that makes
Listfacet combine its selection as AND instead of OR.
http://code.google.com/p/simile-widgets/issues/detail?id=406

Just a note to say I find this change (Michiel with Russell's additions)
really helpful for my particular project (a database of thousands of
academic journal articles, with various keywords acting as the facets.)
Thanks to you both for your contributions.

codesite...@google.com

unread,
Jul 8, 2015, 7:08:33 PM7/8/15
to simile-wi...@googlegroups.com

Comment #5 on issue 406 by jtoner...@gmail.com: Add setting that makes
Listfacet combine its selection as AND instead of OR.
https://code.google.com/p/simile-widgets/issues/detail?id=406

Hi

Is it possible to show a working example of this - I think it might be what
I need but cant get it to work.

Many thanks in advance
James

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
Reply all
Reply to author
Forward
0 new messages