Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

Conversation

@mieciu
Copy link
Member

@mieciu mieciu commented May 12, 2025

Lucene syntax is not expected to behave the way Quesma handles it.

Using default text fields, for query like: myText: getAcc it is going to perform case-insensitive, exact match.

This became apparent when playing with Grafana
image
but also applies to Kibana when switching to Lucene query language.
image

We still do not fully implement Lucene syntax translation, but this definitely brings us closer by at least matching the default behavior.

Useful notes for reproducing this situation 👇

## Create two indices to have comparison

curl -X PUT "http://localhost:8080/es" -H 'Content-Type: application/json' -d '
{
  "mappings": {
    "properties": {
      "myText": {
        "type": "text"
      },
      "@timestamp": {
        "type": "date"
      }
    }
  }
}'


curl -X PUT "http://localhost:8080/ch" -H 'Content-Type: application/json' -d '
{
  "mappings": {
    "properties": {
      "myText": {
        "type": "text"
      }
    }
  }
}'

## Example dataset, save into `data.ndjson`
{"index": {"_index": "es"}}
{"myText": "getAccomondationStatus", "@timestamp": "2025-05-13T10:00:00Z"}
{"index": {"_index": "es"}}
{"myText": "getAccomodationOffer", "@timestamp": "2025-05-13T10:01:00Z"}
{"index": {"_index": "es"}}
{"myText": "getAccomodation", "@timestamp": "2025-05-13T10:02:00Z"}
{"index": {"_index": "ch"}}
{"myText": "getAccomondationStatus", "@timestamp": "2025-05-13T10:00:00Z"}
{"index": {"_index": "ch"}}
{"myText": "getAccomodationOffer", "@timestamp": "2025-05-13T10:01:00Z"}
{"index": {"_index": "ch"}}
{"myText": "getAccomodation", "@timestamp": "2025-05-13T10:02:00Z"}

Load data

curl -X POST "http://localhost:8080/_bulk"
-H "Content-Type: application/x-ndjson"
--data-binary "@data.ndjson"

Fixes: #1425

@mieciu mieciu marked this pull request as ready for review May 13, 2025 12:14
@mieciu mieciu requested a review from a team as a code owner May 13, 2025 12:14
@mieciu mieciu changed the title Fix lucene syntax Fix Lucene query behavior (match operator) May 13, 2025
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented May 13, 2025

Deploying quesma with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5fbb9cc
Status: ✅  Deploy successful!
Preview URL: https://e8f9f27e.quesma.pages.dev
Branch Preview URL: https://fix-lucene-syntax.quesma.pages.dev

View logs

@mieciu mieciu enabled auto-merge May 13, 2025 12:51
@mieciu
Copy link
Member Author

mieciu commented May 13, 2025

/run-integration-tests

@mieciu
Copy link
Member Author

mieciu commented May 13, 2025

/run-it

@mieciu mieciu disabled auto-merge May 13, 2025 13:30
@mieciu mieciu added this pull request to the merge queue May 13, 2025
Merged via the queue into main with commit 867d2fe May 13, 2025
8 checks passed
@mieciu mieciu deleted the fix-lucene-syntax branch May 13, 2025 14:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix __quesma_match for KQL and Lucene

3 participants