Skip to content

Commit d4e10d3

Browse files
committed
chore: apply AI code review suggestions
Fix the Rust library example so it compiles (gemini, cubic): - QueryOptions.top_k is Option<usize> -> top_k: Some(3) (was a bare 3) - CspIndex::from_path takes &Path -> Path::new("./my-project") with 'use std::path::Path' (str::as_ref is ambiguous across AsRef impls)
1 parent 42f6afd commit d4e10d3

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

README.ko.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,11 +445,12 @@ csp clear all # 인덱스 캐시와 savings 모두 삭제
445445
`csp`는 Rust 라이브러리 크레이트(`csp`, [`crates/csp`](crates/csp))로도 사용할 수 있습니다. 자체 도구를 만들거나 검색을 Rust 코드에 직접 통합할 때 유용합니다. `CspIndex`(`from_path` / `from_git` / `search` / `find_related`)와 `ContentType` enum, 랭킹 파이프라인을 노출합니다.
446446

447447
```rust
448+
use std::path::Path;
448449
use csp::indexing::index::{CspIndex, LoadOptions, QueryOptions};
449450

450451
// 로컬 디렉터리를 인덱싱하고 검색
451-
let index = CspIndex::from_path("./my-project".as_ref(), &LoadOptions::default())?;
452-
let results = index.search("save model to disk", &QueryOptions { top_k: 3, ..Default::default() });
452+
let index = CspIndex::from_path(Path::new("./my-project"), &LoadOptions::default())?;
453+
let results = index.search("save model to disk", &QueryOptions { top_k: Some(3), ..Default::default() });
453454

454455
for r in &results {
455456
println!("{}:{}-{}", r.chunk.file_path, r.chunk.start_line, r.chunk.end_line);

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,11 +445,12 @@ Explicit index paths written with `csp index -o <path>` are not part of the auto
445445
`csp` is also a Rust library crate (`csp`, in [`crates/csp`](crates/csp)), useful when building custom tooling or integrating search directly into your own Rust code. It exposes `CspIndex` with `from_path` / `from_git` / `search` / `find_related`, plus the `ContentType` enum and the ranking pipeline.
446446

447447
```rust
448+
use std::path::Path;
448449
use csp::indexing::index::{CspIndex, LoadOptions, QueryOptions};
449450

450451
// Index a local directory and search it
451-
let index = CspIndex::from_path("./my-project".as_ref(), &LoadOptions::default())?;
452-
let results = index.search("save model to disk", &QueryOptions { top_k: 3, ..Default::default() });
452+
let index = CspIndex::from_path(Path::new("./my-project"), &LoadOptions::default())?;
453+
let results = index.search("save model to disk", &QueryOptions { top_k: Some(3), ..Default::default() });
453454

454455
for r in &results {
455456
println!("{}:{}-{}", r.chunk.file_path, r.chunk.start_line, r.chunk.end_line);

0 commit comments

Comments
 (0)