Skip to content

Commit

Permalink
fix(ui): improved checking on the result
Browse files Browse the repository at this point in the history
  • Loading branch information
massi-ang authored and bigadsoleiman committed Jan 23, 2024
1 parent 9636a3c commit b7408dd
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export default function SemanticSearch() {
data.workspace?.value,
data.query
);
console.log(result.data?.performSemanticSearch);
setSearchResult(result.data?.performSemanticSearch);
} catch (error: any) {
console.error(error);
Expand Down Expand Up @@ -135,30 +136,36 @@ export default function SemanticSearch() {
label: "Results",
id: "results",
content: (
<ResultItems items={searchResult!.items!} result={searchResult} />
<ResultItems items={searchResult.items!} result={searchResult} />
),
});

if (searchResult!.vectorSearchItems!.length > 0) {
if (
searchResult.vectorSearchItems &&
searchResult.vectorSearchItems.length > 0
) {
tabs.push({
label: "Vector Search",
id: "vector-search",
content: (
<ResultItems
items={searchResult!.vectorSearchItems!}
items={searchResult.vectorSearchItems}
result={searchResult}
/>
),
});
}

if (searchResult.keywordSearchItems!.length > 0) {
if (
searchResult.keywordSearchItems &&
searchResult.keywordSearchItems.length > 0
) {
tabs.push({
label: "Keyword Search",
id: "keyword-search",
content: (
<ResultItems
items={searchResult!.keywordSearchItems!}
items={searchResult.keywordSearchItems}
result={searchResult}
/>
),
Expand Down

0 comments on commit b7408dd

Please sign in to comment.