Repository navigation
feat: add open for read only fulltext index - #9222
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
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
📒 Files selected for processing (9)
lib/gridstore/src/gridstore/mod.rslib/gridstore/src/gridstore/reader.rslib/gridstore/src/gridstore/tests.rslib/gridstore/src/pages.rslib/gridstore/src/tracker.rslib/segment/src/index/field_index/full_text_index/mutable_text_index/read_only/lifecycle.rslib/segment/src/index/field_index/full_text_index/mutable_text_index/read_only/mod.rslib/segment/src/index/field_index/full_text_index/read_only/lifecycle.rslib/segment/src/index/field_index/full_text_index/read_only/mod.rs
7f2ebf5 to
37f2bb6
Compare
There was a problem hiding this comment.
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
📒 Files selected for processing (4)
lib/segment/src/index/field_index/full_text_index/mutable_text_index/read_only/lifecycle.rslib/segment/src/index/field_index/full_text_index/mutable_text_index/read_only/mod.rslib/segment/src/index/field_index/full_text_index/read_only/lifecycle.rslib/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
| /// uniformly. No `create_if_missing`: the read path never creates; | ||
| /// [`Ok(None)`] propagates from the leaf when the on-disk directory | ||
| /// doesn't exist. |
There was a problem hiding this comment.
🧩 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 || trueRepository: 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 || trueRepository: 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.
| /// 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.
There was a problem hiding this comment.
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);
};
// ...
}70517f2 to
3a38879
Compare
bf1145a to
323c429
Compare
* feat: add open methods for fulltext * fix: naming * feat: detect not-found via error in fulltext index open * fix: hw counter write -> read
All Submissions:
devbranch (notmaster) and my branch was created fromdev.New Feature Submissions:
cargo +nightly fmt --allcommand prior to submission?cargo clippy --workspace --all-featurescommand?Changes to Core Features: