[hibernate-issues] [Hibernate-JIRA] Issue Comment Edited: (HSEARCH-812) Faceting: Possibiltiy to set behaviour (SHOULD/MUST) when selecting multiple facets should
Elmer van Chastelet (JIRA)
noreply at atlassian.com
Thu Jul 28 06:33:14 EDT 2011
[ http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43090#comment-43090 ]
Elmer van Chastelet edited comment on HSEARCH-812 at 7/28/11 5:32 AM:
----------------------------------------------------------------------
The attached [HSEARCH-812.diff|https://hibernate.onjira.com/secure/attachment/16143/HSEARCH-812.diff] is a patch that enables one to set the default occur type.
i.e. for must (AND):
fullTextQuery.getFacetManager().getFacetGroup(facetName).must().selectFacets(actualFacet);
should (OR, this is the default):
fullTextQuery.getFacetManager().getFacetGroup(facetName).should().selectFacets(actualFacet);
was (Author: elmer):
The attached HSEARCH-812.diff is a patch that enables one to set the default occur type, i.e. for must (AND):
fullTextQuery.getFacetManager().getFacetGroup(facetName).must().selectFacets(actualFacet);
should (OR, this is the default): fullTextQuery.getFacetManager().getFacetGroup(facetName).should().selectFacets(actualFacet);
> Faceting: Possibiltiy to set behaviour (SHOULD/MUST) when selecting multiple facets should
> ------------------------------------------------------------------------------------------
>
> Key: HSEARCH-812
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-812
> Project: Hibernate Search
> Issue Type: Improvement
> Components: query
> Affects Versions: 3.4.0.Final
> Environment: -
> Reporter: Elmer van Chastelet
> Labels: faceting
> Attachments: HSEARCH-812.diff
>
>
> Current implementation combines multiple facets from the same group by OR-ing them (SHOULD):
> {code}
> private Query createSelectionGroupQuery(FacetSelectionImpl selection) {
> BooleanQuery orQuery = new BooleanQuery();
> for ( Facet facet : selection.getFacetList() ) {
> orQuery.add( facet.getFacetQuery(), BooleanClause.Occur.SHOULD );
> }
> return orQuery;
> }
> {code}
> It might be useful to also allow AND-ing the facets.
> Some examples:
> When searching for publications, I want the publications where both 'Kim' and 'John' are author
> When searching for recipes, I want meals with both 'tomatoes' and 'eggs'.
> This is in case of fields that might have mutliple values, so its working is relying on [HSEARCH-726|https://hibernate.onjira.com/browse/HSEARCH-726].
> I currently have adapted the code myself, to be able to set AND/OR as default facet combinator, but this is not using the Hibernate Search Query language contexts. This improvement should be easy to implement.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list