Grooper Help - Version 25.0
25.0.0017 2,127
  • Overview
  • Help Status

Lucene Group

Lucene Query Grooper.GPT

Represents a group of search conditions combined using boolean logic for Azure AI Search queries.

Remarks

The Lucene Group class is used to combine multiple Lucene Query conditions into a single logical group, allowing you to construct complex search expressions using boolean operators such as AND and OR. Group queries enable advanced filtering and retrieval scenarios by specifying how multiple conditions should be evaluated together.

Purpose and Usage

  • Use Lucene Group to combine two or more search conditions, such as words, phrases, or other groups.
  • Supports boolean logic, enabling you to require that all conditions are met (AND) or that any condition is met (OR).
  • Can be nested to create highly flexible and expressive search queries.

Lucene Syntax Examples: Grouping and Order of Operations

Groups are indicated by parentheses in Lucene syntax. Parentheses control the order of operations and precedence when combining multiple conditions and operators.

Basic Grouping:
(invoice AND paid)
Returns documents containing both "invoice" and "paid".

OR Grouping:
(contract OR agreement)
Returns documents containing either "contract" or "agreement".

Nested Groups:
((invoice AND paid) OR (contract AND signed))
Returns documents that either contain both "invoice" and "paid", or both "contract" and "signed".

Operator Precedence Example:
invoice AND (paid OR overdue)
Returns documents containing "invoice" and either "paid" or "overdue".

Complex Example:
(category:finance AND (invoice OR receipt)) OR (category:legal AND contract)
Returns documents in the "finance" category that contain either "invoice" or "receipt", or documents in the "legal" category that contain "contract".

Grouping with parentheses ensures that your intended logic is preserved, especially when mixing AND/OR operators. Without grouping, operator precedence may lead to unexpected results.

Configuration Guidance

  • Add one or more Lucene Query objects to the 'Conditions' property to define the set of criteria to be evaluated.
  • Set the 'Operator' property to control whether all conditions must be met (AND) or any condition may be met (OR). If not set, the default behavior is OR.
  • Combine with the 'Field Name' and 'Not' properties (inherited from Lucene Query) to further refine your search.

Best Practices

  • Use groups to organize and clarify complex search logic, especially when combining multiple terms or phrases.
  • Choose the appropriate boolean operator to match your retrieval goals (e.g., AND for strict filtering, OR for broader results).
  • Nest groups as needed to represent complex logic, but keep queries as simple as possible for maintainability.
  • Test group queries in the Azure portal or Grooper UI to ensure they return the expected results.

Example Scenarios

  • Find documents containing both invoice and paid:
    (invoice AND paid)
  • Find documents containing either contract or agreement:
    (contract OR agreement)
  • Combine groups for advanced logic:
    ((invoice AND paid) OR (contract AND signed))

Properties

NameTypeDescription
Notification