Skip to content

Commit

Permalink
bugfix: scroll in wrong order in-page
Browse files Browse the repository at this point in the history
  • Loading branch information
skeptrunedev committed Aug 7, 2024
1 parent 062ea08 commit 482d7d7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion frontends/search/src/components/ResultsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ const ResultsPage = (props: ResultsPageProps) => {
props.search.debounced.query === ""
) {
searchRoute = "chunks/scroll";
requestBody["sort_by"] = undefined;
requestBody["sort_by"] = sort_by;
} else {
searchRoute = "chunk/search";
groupUnique = props.search.debounced.groupUniqueSearch;
Expand Down
2 changes: 1 addition & 1 deletion frontends/search/src/components/SearchForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ const SearchForm = (props: {
} else {
return {
...item,
isSelected: item.isSelected,
isSelected: false,
};
}
});
Expand Down
21 changes: 17 additions & 4 deletions server/src/handlers/chunk_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1510,13 +1510,26 @@ pub async fn scroll_dataset_chunks(
)
.await?;

let chunks = get_chunk_metadatas_from_point_ids(qdrant_point_ids, pool)
.await?
let chunks: Vec<ChunkMetadata> =
get_chunk_metadatas_from_point_ids(qdrant_point_ids.clone(), pool)
.await?
.into_iter()
.map(ChunkMetadata::from)
.collect();

let ordered_chunks = qdrant_point_ids
.into_iter()
.map(ChunkMetadata::from)
.filter_map(|point_id| {
chunks
.iter()
.find(|chunk| chunk.qdrant_point_id == point_id)
.cloned()
})
.collect();

let resp = ScrollChunksResponseBody { chunks };
let resp = ScrollChunksResponseBody {
chunks: ordered_chunks,
};

Ok(HttpResponse::Ok().json(resp))
}
Expand Down

0 comments on commit 482d7d7

Please sign in to comment.