Skip to content

Commit

Permalink
chore: fix review
Browse files Browse the repository at this point in the history
Signed-off-by: Wei Zhang <[email protected]>
  • Loading branch information
zwpaper committed Dec 23, 2024
1 parent c1f15c4 commit e3c8988
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions crates/tabby-index/src/code/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ async fn add_changed_documents(
// Skip if already indexed and has no failed chunks,
// when skip, we should check if the document needs to be backfilled.
if !require_updates(cloned_index.clone(), &id) {
backfill_commit_if_needed(
backfill_commit_in_doc_if_needed(
builder.clone(),
cloned_index.clone(),
&id,
Expand Down Expand Up @@ -161,7 +161,7 @@ fn require_updates(indexer: Arc<Indexer>, id: &str) -> bool {
}

// v0.23.0 add the commit field to the code document.
async fn backfill_commit_if_needed(
async fn backfill_commit_in_doc_if_needed(
builder: Arc<TantivyDocBuilder<SourceCode>>,
indexer: Arc<Indexer>,
id: &str,
Expand All @@ -182,7 +182,7 @@ async fn backfill_commit_if_needed(
let origin = indexer.get_doc(id).await?;
indexer.delete_doc(id);
indexer
.add(builder.backfill_attribute(&origin, &code).await)
.add(builder.backfill_doc_attributes(&origin, &code).await)
.await;

Ok(())
Expand Down
6 changes: 5 additions & 1 deletion crates/tabby-index/src/indexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,11 @@ impl<T: ToIndexId> TantivyDocBuilder<T> {
}
}

pub async fn backfill_attribute(&self, origin: &TantivyDocument, doc: &T) -> TantivyDocument {
pub async fn backfill_doc_attributes(
&self,
origin: &TantivyDocument,
doc: &T,
) -> TantivyDocument {
let schema = IndexSchema::instance();
let mut doc = doc! {
schema.field_id => get_text(origin, schema.field_id),
Expand Down

0 comments on commit e3c8988

Please sign in to comment.