Skip to content

Read a * inside quotes as text, as Lucene's parser does, so "of sou*" is the phrase "of sou" (#439) - #440

Draft
jasperblues wants to merge 2 commits into
mainfrom
fix-439-quoted-star
Draft

jasperblues wants to merge 2 commits into
mainfrom
fix-439-quoted-star

Conversation

@jasperblues

Copy link
Copy Markdown
Member

Closes #439. Port of liberation-data/drivine4j#622 (drivine4j PR #632), as liberation-data/drivine#647 ports it. Not to merge until train 2026.11.2 is published, and not before drivine#647.

_term_of (drivine/backend/sql/text_query.py) read a quoted phrase ending in *, "of sou*", as a prefix phrase, so it matched "of soup". Lucene's classic parser, as Neo4j uses it, reads a * inside quotes as text, so Neo4j searches for the phrase "of sou". A term is now a prefix only when its token isn't quoted. Oracle Text follows: "graph pre*" becomes ({graph pre}).

Goldens: unchanged.

Tests

  • tests/integration/test_bm25.py, and its sync copy, on Neo4j, Postgres, Postgres indexed, SQLite and Oracle: "of sou*" finds nothing, and "of soup*" finds "a graph of soup".
  • tests/unit/test_text_query.py:
    • the scored patterns of "of sou*", body:"of sou*", "of sou\*", "kiw*", sou* and +kiw*;
    • the Oracle Text forms of "graph pre*", "kiw*" and body:"of sou*".

Verification

  • Two fresh-reviewer passes. Pass 1 added the Oracle Text cases, the class docstring and the docs/02 and docs/07 notes; pass 2 came back clean.
  • Unit tests: 2,478 passed. ruff and pyright are clean, and the sync code is current.
  • Integration, on the test box with Oracle: the BM25 tests, their sync copy, and the search tests. 191 passed, and agreement with Neo4j is unchanged at 17/21.

This branch has not been deployed

No deployments
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.

Full-text search reads a * inside quotes, "of sou*", as a prefix, where Neo4j's parser searches for the phrase "of sou"

1 participant