Index published post/translation bodies in full-text search #66

Closed
opened 2026-07-20 19:43:56 +00:00 by hugo · 1 comment
Owner

Source: Audit section 1.2 (high impact). Compat contract: "full-text search behaviour MUST stay identical" (specs/bds.allium).

Current behaviour (RuDS): Both FTS index paths pass DB content only:

  • crates/bds-core/src/engine/post.rs fn fts_index_post (~line 898) passes post.content.as_deref() and t.content.clone().
  • crates/bds-core/src/engine/search.rs fn index_project (~line 196) does the same during rebuild.
    Published posts/translations have content = NULL in the DB (body lives only in the .md file), so their bodies are never indexed — body search over a published blog finds nothing.

bDS2 behaviour: ../bDS2/lib/bds/search.expost_content/1 (~line 657) and translation_content/2 (~line 670) fall back to reading the markdown body from file_path when DB content is nil.

Task: Thread data_dir into both index paths and read the body from the post/translation file when DB content is NULL (reuse read_post_file/read_translation_file; the editor-body resolver pattern already exists — see specs/post.allium editor_body). Also unify the fallback stemmer language: fts_index_post uses unwrap_or("en") while the rebuild path uses project mainLanguage — bDS2 uses post language, else project main language, in both paths.

Acceptance: Red/green TDD — new test: publish a post with a distinctive body word, search finds it; same for a published translation. Rebuild path test likewise. cargo test --workspace green (loopback-server tests need network-bind permission on first run).

**Source:** Audit section 1.2 (high impact). Compat contract: "full-text search behaviour MUST stay identical" (`specs/bds.allium`). **Current behaviour (RuDS):** Both FTS index paths pass DB content only: - `crates/bds-core/src/engine/post.rs` fn `fts_index_post` (~line 898) passes `post.content.as_deref()` and `t.content.clone()`. - `crates/bds-core/src/engine/search.rs` fn `index_project` (~line 196) does the same during rebuild. Published posts/translations have `content = NULL` in the DB (body lives only in the .md file), so their bodies are never indexed — body search over a published blog finds nothing. **bDS2 behaviour:** `../bDS2/lib/bds/search.ex` — `post_content/1` (~line 657) and `translation_content/2` (~line 670) fall back to reading the markdown body from `file_path` when DB content is nil. **Task:** Thread `data_dir` into both index paths and read the body from the post/translation file when DB content is NULL (reuse `read_post_file`/`read_translation_file`; the editor-body resolver pattern already exists — see `specs/post.allium` `editor_body`). Also unify the fallback stemmer language: `fts_index_post` uses `unwrap_or("en")` while the rebuild path uses project mainLanguage — bDS2 uses post language, else project main language, in both paths. **Acceptance:** Red/green TDD — new test: publish a post with a distinctive body word, search finds it; same for a published translation. Rebuild path test likewise. `cargo test --workspace` green (loopback-server tests need network-bind permission on first run).
hugo added the bug label 2026-07-20 19:43:56 +00:00
Author
Owner

hopefully fixed with fix on github

hopefully fixed with fix on github
hugo closed this issue 2026-07-21 13:21:51 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: hugo/RuDS#66