Skip to content

Reinterpret a broken query as straight string query.#1699

Open
jannistsiroyannis wants to merge 1 commit intodevelopfrom
feature/bad-query-as-string2
Open

Reinterpret a broken query as straight string query.#1699
jannistsiroyannis wants to merge 1 commit intodevelopfrom
feature/bad-query-as-string2

Conversation

@jannistsiroyannis
Copy link
Contributor

@jannistsiroyannis jannistsiroyannis commented Feb 23, 2026

This is the second variant of turning a bad query into just a string query.

This one essentially turns:

bad:query) NOT < 12
into
bad query 12

A (severe) drawback of this (needing to be done at the language level) is that it affects all querys. For example a broken sru-query will also resort to this, and the
( sru-stuff ) and type:instance
breaks down to
sru-stuff type instance
which is gonna look pretty broken.

The ultimately best and correct version would be for the frontend (which also does parsing) to do the exact equivalent of what this PR does instead. Since it is really only human-entered (frontend) querys we want to treat this loosely.

This PR is mutually exclusive with #1697

@kwahlin
Copy link
Contributor

kwahlin commented Feb 23, 2026

Haven't really thought it through but I think a simple solution could be something like:

   try {
            return buildTree(getAst(queryString).tree, disambiguate, null, null);
        } catch (InvalidQueryException e) {
            return new FreeText(queryString);
        }

here:

return buildTree(getAst(queryString).tree, disambiguate, null, null);

@jannistsiroyannis
Copy link
Contributor Author

jannistsiroyannis commented Feb 23, 2026

Sure! But it would have essentially the same effect, no? Including the sru/xsearch drawback.

We could of course be passing an additional parameter "strictQuery" true/false or something, to compensate for it. But that would also be equally true for both solutions.

@kwahlin
Copy link
Contributor

kwahlin commented Feb 23, 2026

Sure! But it would have essentially the same effect, no? Including the sru/xsearch drawback.

We could of course be passing an additional parameter "strictQuery" true/false or something, to compensate for it. But that would also be equally true for both solutions.

Same effect, yes! If we want better accuracy (interpreting only the broken part as free text) we’ll need something else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants