Uploaded image for project: 'Hibernate Search'
  1. HSEARCH-812

Possibiltiy to set boolean type (SHOULD/MUST) when selecting multiple facets

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects versions: None
    • Fix versions: 5.3.0.Beta1
    • Components: query
    • Labels:
    • Environment:
      -

      Description

      Current implementation combines multiple facets from the same group by OR-ing them (SHOULD):

      private Query createSelectionGroupQuery(FacetSelectionImpl selection) {
            BooleanQuery orQuery = new BooleanQuery();
            for ( Facet facet : selection.getFacetList() ) {
               orQuery.add( facet.getFacetQuery(), BooleanClause.Occur.SHOULD );
            }
            return orQuery;
         }
      

      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.

      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.

        Attachments

        1. HSEARCH-812.diff
          2 kB
          Elmer van Chastelet
        2. HSEARCH-812-doc.diff
          1 kB
          Elmer van Chastelet

          Issue links

            Activity

              People

              • Assignee:
                hardy.ferentschik Hardy Ferentschik
                Reporter:
                elmer Elmer van Chastelet
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: