Skip to content

feat: add open for read only fulltext index - #9222

Merged
dancixx merged 4 commits into
devfrom
feat/readonly-fulltext-index-open
Jun 2, 2026
Merged

dancixx merged 4 commits into
devfrom
feat/readonly-fulltext-index-open

Conversation

@dancixx

@dancixx dancixx commented May 28, 2026

Copy link
Copy Markdown
Contributor

All Submissions:

⚠️ PRs must target the dev branch. If your PR targets master, please change the base branch to dev before requesting a review.

  • My PR targets the dev branch (not master) and my branch was created from dev.
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you formatted your code locally using cargo +nightly fmt --all command prior to submission?
  3. Have you checked your code using cargo clippy --workspace --all-features command?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@coderabbitai

This comment was marked as resolved.

@dancixx
dancixx marked this pull request as draft May 28, 2026 14:12
Base automatically changed from feat/gridstore-readonly-open to dev May 28, 2026 20:34
@dancixx
dancixx marked this pull request as ready for review May 29, 2026 11:49
@dancixx
dancixx requested a review from generall May 29, 2026 11:50

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@lib/segment/src/index/field_index/full_text_index/mutable_text_index/read_only/lifecycle.rs`:
- Around line 37-40: The existence check currently calls path.exists(), which
bypasses the provided UniversalRead filesystem handle `fs`; replace that call
with the filesystem-backed existence check (e.g., use `fs.exists(&path)` or the
appropriate `exists` method on the `UniversalRead` type) so the code consults
the supplied `fs` rather than the host FS, and propagate/handle the Result from
that call where the `Ok(None)` branch is returned; update the check around
`path.exists()` to use the `fs` method on the same `path` variable (and handle
any errors returned).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 3be0b793-9a34-4795-b51d-3eb28cc1b5e6

📥 Commits

Reviewing files that changed from the base of the PR and between 47cfd37 and 7f2ebf5.

📒 Files selected for processing (9)
  • lib/gridstore/src/gridstore/mod.rs
  • lib/gridstore/src/gridstore/reader.rs
  • lib/gridstore/src/gridstore/tests.rs
  • lib/gridstore/src/pages.rs
  • lib/gridstore/src/tracker.rs
  • lib/segment/src/index/field_index/full_text_index/mutable_text_index/read_only/lifecycle.rs
  • lib/segment/src/index/field_index/full_text_index/mutable_text_index/read_only/mod.rs
  • lib/segment/src/index/field_index/full_text_index/read_only/lifecycle.rs
  • lib/segment/src/index/field_index/full_text_index/read_only/mod.rs

@generall generall added this to the Live-reload milestone May 30, 2026
@dancixx
dancixx force-pushed the feat/readonly-fulltext-index-open branch from 7f2ebf5 to 37f2bb6 Compare June 2, 2026 09:15

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@lib/segment/src/index/field_index/full_text_index/read_only/lifecycle.rs`:
- Around line 20-22: The doc comment in the read-only lifecycle section
incorrectly uses an intra-doc link syntax [`Ok(None)`] which triggers an
unresolved rustdoc link warning; update the comment to use a plain code span
(Ok(None)) instead—locate the doc block that mentions "No `create_if_missing`:
the read path never creates;" in the read-only lifecycle module (lifecycle.rs)
and replace the bracketed link with a simple backtick-wrapped Ok(None) code span
so rustdoc treats it as inline code, not a link.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 7132cad3-d27a-4ecf-8e1d-ddd711652400

📥 Commits

Reviewing files that changed from the base of the PR and between 7f2ebf5 and 37f2bb6.

📒 Files selected for processing (4)
  • lib/segment/src/index/field_index/full_text_index/mutable_text_index/read_only/lifecycle.rs
  • lib/segment/src/index/field_index/full_text_index/mutable_text_index/read_only/mod.rs
  • lib/segment/src/index/field_index/full_text_index/read_only/lifecycle.rs
  • lib/segment/src/index/field_index/full_text_index/read_only/mod.rs
✅ Files skipped from review due to trivial changes (1)
  • lib/segment/src/index/field_index/full_text_index/mutable_text_index/read_only/mod.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • lib/segment/src/index/field_index/full_text_index/mutable_text_index/read_only/lifecycle.rs

Comment on lines +20 to +22
/// uniformly. No `create_if_missing`: the read path never creates;
/// [`Ok(None)`] propagates from the leaf when the on-disk directory
/// doesn't exist.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check whether the crate denies broken intra-doc links (would turn the warning into a build failure)
rg -nP 'broken_intra_doc_links|rustdoc::all|deny\(rustdoc' -g '*.rs' -g '*.toml'

Repository: qdrant/qdrant

Length of output: 39


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# 1) Read the doc comment region around the reported lines
sed -n '1,120p' lib/segment/src/index/field_index/full_text_index/read_only/lifecycle.rs | nl -ba | sed -n '10,90p'

# 2) Confirm whether any rustdoc/CI config denies broken intra-doc links
#    (expand search beyond just .rs/.toml to catch e.g. CI yaml)
rg -n --hidden --glob '!**/target/**' \
  '(broken_intra_doc_links|rustdoc::all|deny\(rustdoc|unresolved link|broken intra-doc)' \
  . -S || true

# 3) Read the repo review rules (as required) for any relevant style/expectations
ls -la .github || true
cat .github/review-rules.md 2>/dev/null || true

Repository: qdrant/qdrant

Length of output: 100


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# 1) Show the relevant doc comment region (use cat -n since nl isn't available)
sed -n '1,120p' lib/segment/src/index/field_index/full_text_index/read_only/lifecycle.rs | cat -n | sed -n '10,90p'

# 2) Confirm whether any rustdoc/CI config denies broken intra-doc links
rg -n --hidden --glob '!**/target/**' \
  '(broken_intra_doc_links|rustdoc::all|deny\(rustdoc|unresolved link|broken intra-doc)' \
  . -S || true

# 3) Read repo review rules (required by instructions)
ls -la .github || true
cat .github/review-rules.md 2>/dev/null || true

Repository: qdrant/qdrant

Length of output: 6428


Fix broken intra-doc link for Ok(None) in read-only lifecycle docs

[Ok(None)] is parsed as an intra-doc link target, producing an “unresolved link” rustdoc warning. Use a plain code span (Ok(None)) instead.

✏️ Proposed fix
-    /// [`Ok(None)`] propagates from the leaf when the on-disk directory
+    /// `Ok(None)` propagates from the leaf when the on-disk directory
     /// doesn't exist.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/// uniformly. No `create_if_missing`: the read path never creates;
/// [`Ok(None)`] propagates from the leaf when the on-disk directory
/// doesn't exist.
/// uniformly. No `create_if_missing`: the read path never creates;
/// `Ok(None)` propagates from the leaf when the on-disk directory
/// doesn't exist.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/segment/src/index/field_index/full_text_index/read_only/lifecycle.rs`
around lines 20 - 22, The doc comment in the read-only lifecycle section
incorrectly uses an intra-doc link syntax [`Ok(None)`] which triggers an
unresolved rustdoc link warning; update the comment to use a plain code span
(Ok(None)) instead—locate the doc block that mentions "No `create_if_missing`:
the read path never creates;" in the read-only lifecycle module (lifecycle.rs)
and replace the bracketed link with a simple backtick-wrapped Ok(None) code span
so rustdoc treats it as inline code, not a link.

@ffuugoo ffuugoo left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Though, I'd deduplicate open and MutableFullTextIndex::open_gridstore. We have a lot of "copy-pasted" code like this and it's annoying when you need to update it and have to change 2-3-N different functions that do the same, but each is written slightly differently. And also instead of explaining "this does exactly what open_gridstore does but for read-only", you could just see it from the code.

UPD: Ah, I see we use Gridstore vs GridstoreReader.

Nevermind then. 😔

One of these maybe?

// simple
fn load_full_text_index(
    store: &GridstoreReader,
    phrase_matching: bool,
) -> OperationResult<MutableInvertedIndex> {
    let mut builder = ...;
    storage.iter(...)?;
    Ok(builder.build())
}

// full
fn open_full_text_index<const ALLOW_CREATE_IF_MISSING: bool>(
    fs: Fs,
    path: PathBuf,
    create_if_missing: bool,
    phrase_matching: bool,
) -> OperationResult<MutableInvertedIndex> {
    let store = if ALLOW_CREATE_IF_MISSING && create_if_missing {
        // ...
    } else if path.exists() {
        // ...
    } else {
        return Ok(None);
    };

    // ...
}

@dancixx
dancixx force-pushed the feat/readonly-fulltext-index-open branch 2 times, most recently from 70517f2 to 3a38879 Compare June 2, 2026 14:36
@dancixx
dancixx force-pushed the feat/readonly-fulltext-index-open branch from bf1145a to 323c429 Compare June 2, 2026 15:02
@dancixx
dancixx merged commit 46844ab into dev Jun 2, 2026
12 checks passed
@dancixx
dancixx deleted the feat/readonly-fulltext-index-open branch June 2, 2026 15:03
@coderabbitai coderabbitai Bot mentioned this pull request Jun 2, 2026
9 tasks
timvisee pushed a commit that referenced this pull request Jun 3, 2026
* feat: add open methods for fulltext

* fix: naming

* feat: detect not-found via error in fulltext index open

* fix: hw counter write -> read
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.

3 participants