Skip to content

Commit

Permalink
feature(search): total results
Browse files Browse the repository at this point in the history
  • Loading branch information
Misaka-L committed Apr 14, 2024
1 parent be45b81 commit 75d5a49
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions server/searchUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export async function search(

return {
timing: searchResult.timing,
total: searchResult.debug._data.value,
hits: searchResult.hits.map((hit) => ({
title: hit._source.title,
chunkContent: hit._source.chunk.content,
Expand Down
6 changes: 6 additions & 0 deletions server/types/searchBackend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ interface SearchResultDebugQueryBackend {
size: number
}

interface SearchResultDebugDataBackend {
value: number
relation: string
}

interface SearchResultDebugBackend {
_score: SearchResultDebugScoreBackend
query: SearchResultDebugQueryBackend
_data: SearchResultDebugDataBackend
}

interface SearchResultChunkBackend {
Expand Down
1 change: 1 addition & 0 deletions types/search.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
interface SearchResult {
timing: SearchResultTiming
hits: SearchHit[]
total: number
}

interface SearchResultTiming {
Expand Down

0 comments on commit 75d5a49

Please sign in to comment.