Skip to content

Query: text conditions run through gufi_vt; an unbuilt main folder is "not indexed yet" - #597

Merged
Matthew Shaxted (mattshax) merged 2 commits into
mainfrom
query-vt-words
Oct 25, 2026
Merged

Matthew Shaxted (mattshax) merged 2 commits into
mainfrom
query-vt-words

Conversation

@mattshax

Copy link
Copy Markdown
Member

Two Query issues found by the macOS end-to-end test on v1.174.

Text conditions fell back to the merge. A Query across libraries with a "has the words" condition answered with engine: "merge", while name and size conditions used gufi_vt. gufi_vt takes each SQL stage as a double-quoted value (E="...") read verbatim, so fitsVt refused any stage holding a double quote, and a text condition always holds them: #583 writes its FTS5 phrase query as wordf MATCH '"a" AND "b"'.

  • vtStage() in server/src/gufiVt.ts writes each double quote inside a single-quoted string as '||char(34)||', wrapping the literal in parentheses. The string's value is unchanged: FTS5 matches the computed phrase string the same as the literal (checked with gufi_sqlite3). A double quote outside a string (a quoted identifier, a comment) or an unterminated string still leaves the query to the merge.
  • vtScript passes every stage through it, so remote locations' command lines carry no inner double quotes either.
  • A Query across libraries answered by the merge now carries mergeReason: a double quote outside a string, a library path gufi_vt cannot be given, no gufi_vt with remote locations, or the gufi_vt statement's error.

An unbuilt main folder. The main folder counted as indexed whenever its index folder existed (gufiAvailable()), including the empty folder that exists before the first build. Search then found no databases and named nothing, while Query ran gufi_query, failed, and listed it as "index not found".

  • The main folder now counts as indexed once its index has a db.db at the root, as indexStatus().indexed already does.
  • libraryGap says not indexed yet for the main folder before its first build, and keeps index not found for one built before whose index is gone (indexing.ts reports whether the last build of the main folder finished).
  • Search lists it in omitted and does not ask it; Query across libraries lists it the same way, and asked alone answers 409 <label> cannot be queried: not indexed yet.

Tests

  • gufiVtSpaces.test.mjs: vtStage rewrites (phrase quotes, a doubled single quote, a quoted identifier, a comment, an unterminated string); with real GUFI, a words condition across a local library and one through the remote wrapper answers engine: "gufi_vt" with the rows the merge gives; the merge carries its reason.
  • omissions.test.mjs: with real GUFI, search and Query name a never-built main folder not indexed yet (its empty index folder present), and index not found once built and its db.db is moved away; nothing is named once it is back.
  • querySql.test.mjs: its stand-in main index gets a db.db, as a built index has.
  • deploy/mac/check_app.sh: after the existing gufi_vt check across two libraries, a Query with a words condition on the OCR sample word must answer engine: "gufi_vt" with the sample in its rows.
  • Server suite 614 passed, 9 skipped; web suite 277 passed.

docs/REFERENCE.md describes both.

… "not indexed yet"

A Query across libraries with a "has the words" condition answered through
the per-library merge, not gufi_vt. gufi_vt takes each SQL stage as a
double-quoted value read verbatim, so the Studio refused any stage holding
a double quote, and a text condition always has them: its FTS5 phrase query
is MATCH '"a" AND "b"'. A double quote inside a single-quoted string is now
written for gufi_vt as '||char(34)||', which gives the same string, so text
conditions run through gufi_vt with the rows the merge gives. A double quote
outside a string (a quoted identifier, a comment) still sends the query to
the merge. A Query across libraries answered by the merge now carries
mergeReason saying why.

The main folder counted as indexed whenever its index folder existed, even
empty before the first build. Search then found nothing there and named
nothing, while Query ran gufi_query, failed, and said "index not found". It
now counts as indexed once its index has a db.db at the root, as the index
status already does, and both name it alike: "not indexed yet" before its
first build, "index not found" for one built before whose index is gone.

check_app.sh's gufi_vt check adds a query with a words condition.
…n gufi_vt too

The one walk (#596) is the default search; the gufi_vt setting takes its own
route, through the same check before anything runs.
@mattshax
Matthew Shaxted (mattshax) merged commit 7f04e4c into main Oct 25, 2026
10 checks passed
@mattshax
Matthew Shaxted (mattshax) deleted the query-vt-words branch October 25, 2026 13:54
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