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

Lucene Query

Embedded Object Grooper.GPT

Represents a query against an AI Search index to find words or phrases in the text content of documents or fields.

Remarks

A Lucene Query provides the foundation for building complex search queries compatible with AI Search using Lucene query syntax. It enables the creation of fielded, boolean, phrase, and fuzzy search expressions, supporting advanced search scenarios such as boosting, proximity, and exclusion.

Purpose and Usage

Use a Lucene Query to retrieve documents based on the presence of keywords or phrases in the document text or a field. Lucene Query supports field-specific queries, logical operators (AND, OR, NOT), phrase and proximity searches, and term boosting, enabling dynamic query generation for user-driven search interfaces, filtering, and advanced retrieval.

Configuration Guidance

  • Set the 'Field Name' property to restrict the search to a specific field in the Azure index.
  • Use the 'Not' property to exclude documents matching the query.
  • Combine multiple Lucene Query objects using group or boolean operators for complex logic.
  • Use derived types such as Lucene Word and Lucene Phrase for specific query elements.

Best Practices

  • Ensure that field names correspond to searchable fields in your Azure AI Search index.
  • Use quotation marks for multi-word phrases and boost important terms as needed.
  • Test queries using the Azure portal or API to verify expected results.

Example Queries

The following examples demonstrate how to construct Lucene queries.

1. Search for invoices with a specific vendor name

vendor: "Acme Corp"

2. Find documents containing the phrase "confidential report" in the title field

title: "confidential report"

3. Retrieve folders where the status is either 'approved' or 'pending'

status: (approved OR pending)

4. Exclude documents with the term "obsolete" in the description

NOT description: obsolete

5. Search for records with a fuzzy match on the customer name

customer_name: Janice~

6. Boost results containing the phrase "priority shipment"

"priority shipment"^5

7. Find all folders with attachments of type PDF

attachment_type: pdf

8. Search for documents with a specific field value and exclude a location

department: HR AND NOT location: "Remote"

9. Use a regular expression to match invoice numbers starting with 'INV'

invoice_number: /INV.*/

10. Find documents with the word "urgent" within 5 words of "review"

"urgent review"~5

Properties

NameTypeDescription

Derived Types

There are 3 implementations of Lucene Query.

Lucene Group Represents a group of search conditions combined using boolean logic for Azure AI Search queries.
Lucene Phrase Represents a phrase-based search expression for AI Search queries.
Lucene Word Represents a word-based search expression for Azure AI Search queries.

Used By

Notification