apache / apache/texera

Keyword Search ends the run on an unpaired double quote

Open
#8,074 1 comment 0 reactions 1 assignee Claimed by @kz930 View on GitHub
Dominant language
Scala
Stars
314
Forks
187
Avg merge
1d 21h
Merged PRs (30d)
214

Description

### What happened?

The operator hands the typed value straight to Lucene's query parser:

```scala
@transient lazy val query: Query = new QueryParser(desc.attribute, analyzer).parse(desc.keyword)
```

The parser's lexer reads a double quote as opening a phrase, so a value carrying one on its own never terminates it and `parse` throws before a single row is read. The run ends with the error below. The form accepted the value without objection: the field declares only `minLength: 1`.

I checked this against Lucene 8.7's QueryParser, the version the executor uses. `he"llo` throws and `"a b"` parses as a phrase, so it is the pairing rather than the character that decides.

I expected the field to say what it takes. The keyword is a Lucene query, and the pairing rule is one the schema can state: a pattern that allows any number of quoted spans and rejects a lone quote. Other Texera fields already declare what they accept this way, for instance the chart colour settings.

It is not the only value the parser refuses. `wine(` and `foo)` throw as well. Those are not statable the same way: which uses of a parenthesis parse depends on what follows, and a pattern strict enough to catch them would reject the grouped queries that work today.

### How to reproduce?

1. Any table with a text column.
2. Connect Keyword Search, point it at that column, and type `he"llo` as the keyword.
3. Run.

### Version/Branch

1.3.0-incubating-SNAPSHOT (main)

### Relevant log output

```shell
org.apache.lucene.queryparser.classic.ParseException: Cannot parse 'he"llo': Lexical error at line 1, column 7. Encountered: after : "\"llo"
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.