Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lexical parser modification - best effort double quote parsing #979

Open
wants to merge 4 commits into
base: mainline
Choose a base branch
from

Conversation

vicilliar
Copy link
Contributor

@vicilliar vicilliar commented Sep 24, 2024

  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
    Feature

  • What is the current behavior? (You can also link to an open issue here)
    Any bad syntax with "" results in lexical search query being interpreted literally. The unescaped double quotes then cause a 400 from Vespa, resulting in a 500.

  • What is the new behavior (if this is a feature change)?
    Parser logic updated: Badly formatted double quotes are treated as whitespace, terms split by this will be optional. Always tries to interpret double quotes in pairs, from left to right.

'"term one" "term tw"o' --> required_terms = ['term one'], optional_terms = ['term', 'tw', 'o']
'"term one" "term two" "term three' --> required_terms = ['term one', 'term two'], optional_terms = ['term', 'three']
'"term on"e "term two" "term three" --> required_terms = ['term two', 'term three'], optional_terms = ['term', 'on', 'e']
'"ter"m on"e "term two" "term three" --> required_terms = [], optional_terms = ['ter', 'm', 'on', 'e', 'term', 'two', 'three']

Ecape character (\\) is no longer removed from optional and required terms, thus no longer cause a 400 from Vespa.

  • Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
    No, these queries used to 500 anyway.

  • Have unit tests been run against this PR? (Has there also been any additional testing?)
    In progress

  • Related Python client changes (link commit/PR here)

  • Related documentation changes (link commit/PR here)

  • Other information:

  • Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added / updated (for bug fixes / features)

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.

1 participant