FIX: Prevent no results label from showing when untrue (#384)
This commit is contained in:
parent
76f7940b55
commit
5f088b12a7
|
@ -35,17 +35,7 @@ export default class SemanticSearch extends Component {
|
|||
}
|
||||
|
||||
get searchStateText() {
|
||||
if (this.preventAISearch) {
|
||||
return I18n.t("discourse_ai.embeddings.semantic_search_disabled_sort");
|
||||
}
|
||||
if (this.searching) {
|
||||
return I18n.t("discourse_ai.embeddings.semantic_search_loading");
|
||||
}
|
||||
|
||||
if (this.AIResults.length === 0) {
|
||||
return I18n.t("discourse_ai.embeddings.semantic_search_results.none");
|
||||
}
|
||||
|
||||
// Search results:
|
||||
if (this.AIResults.length > 0) {
|
||||
if (this.showingAIResults) {
|
||||
return I18n.t(
|
||||
|
@ -63,12 +53,34 @@ export default class SemanticSearch extends Component {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Search disabled for sort order:
|
||||
if (this.preventAISearch) {
|
||||
return I18n.t("discourse_ai.embeddings.semantic_search_disabled_sort");
|
||||
}
|
||||
|
||||
// Search loading:
|
||||
if (this.searching) {
|
||||
return I18n.t("discourse_ai.embeddings.semantic_search_loading");
|
||||
}
|
||||
|
||||
// Typing to search:
|
||||
if (
|
||||
this.AIResults.length === 0 &&
|
||||
this.searchTerm !== this.initialSearchTerm
|
||||
) {
|
||||
return I18n.t("discourse_ai.embeddings.semantic_search_results.new");
|
||||
}
|
||||
|
||||
// No results:
|
||||
if (this.AIResults.length === 0) {
|
||||
return I18n.t("discourse_ai.embeddings.semantic_search_results.none");
|
||||
}
|
||||
}
|
||||
|
||||
get searchTerm() {
|
||||
if (this.initialSearchTerm !== this.args.outletArgs.search) {
|
||||
this.initialSearchTerm = undefined;
|
||||
this.resetAIResults();
|
||||
}
|
||||
|
||||
return this.args.outletArgs.search;
|
||||
|
@ -116,6 +128,8 @@ export default class SemanticSearch extends Component {
|
|||
return this.performHyDESearch();
|
||||
}
|
||||
|
||||
this.resetAIResults();
|
||||
|
||||
withPluginApi("1.15.0", (api) => {
|
||||
api.onAppEvent("full-page-search:trigger-search", () => {
|
||||
return this.performHyDESearch();
|
||||
|
|
|
@ -172,6 +172,7 @@ en:
|
|||
toggle: "Showing %{count} results found using AI"
|
||||
toggle_hidden: "Hiding %{count} results found using AI"
|
||||
none: "Sorry, our AI search found no matching topics."
|
||||
new: "Press 'Search' to begin looking for new results with AI"
|
||||
ai_generated_result: "Search result found using AI"
|
||||
|
||||
ai_bot:
|
||||
|
|
Loading…
Reference in New Issue