Powered by Zoomin Software. For more details please contactZoomin

Develop with FastTrack

Configuring AND/OR logic for facet widgets

  • Last Updated: May 5, 2026
  • 2 minute read
    • MarkLogic Server
    • Documentation

For the StringFacet and BucketRangeFacet widgets, the logicConfig prop allows users to click buttons to select the AND or OR logical operators when constraining faceted results:

  • AND (Match All): The widget constrains search results to documents that contain all of the selected facet values. This means that all conditions must be true for a result to be returned.

  • OR (Match Any): The widget constrains search results to documents that contain at least one of the selected facet values. This means that if any of the conditions are true in a result, that result is returned.

Configuration example

This code configures the logic for the StringFacet widget using the logicConfig prop.

<StringFacet
  title="Sources"
  name="sources"
  data={context.searchResponse?.facets?.sources}
  onSelect={handleFacetClick}
  logicConfig={{
    defaultOperator: "AND",
    andConfig: {},
    orConfig: {},
  }}
  resetConfig={{ }}
/>

This is rendered:

Example rendering of AND/OR logic buttons.

The defaultOperator value determines the default logic selection, in this case AND (Match All). You can customize the logic buttons with the andConfig and orConfig properties, which implement this:

export interface ILogicConfig {
  /**
   * Toggles visibility.
   */
  hide?: boolean;
  /**
   * Overrides the button label.
   */
  label?: string;
  /**
   * Display helper text describing the operator.
   */
  helpTextConfig?: {
    /**
     * Determines visibility of the message.
     */
    hide?: boolean;
    /**
     * Override to the message displayed.
     * @default OR - 'Shows results that contain at least one of the selected options.'
     * @default AND - 'Shows results that contain all of the selected options.'
     */
    label?: string;
    /**
     * Override the style of the message.
     */
    style?: CSSProperties;
  };
  /**
   * Button configuration.
   * @see http://telerik.com/kendo-react-ui/components/buttons/button
   */
  ButtonProps?: Omit<ButtonProps, 'onClick' | 'children' | 'togglable' | 'selected'>;
}
TitleResults for “How to create a CRG?”Also Available inAlert