Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions app/controllers/discourse_ai/embeddings/embeddings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,19 @@ def search
end

hijack do
semantic_search
.search_for_topics(query, _page = 1, hyde: !skip_hyde)
.each { |topic_post| grouped_results.add(topic_post) }

render_serialized(grouped_results, GroupedSearchResultSerializer, result: grouped_results)
begin
semantic_search
.search_for_topics(query, _page = 1, hyde: !skip_hyde)
.each { |topic_post| grouped_results.add(topic_post) }

render_serialized(
grouped_results,
GroupedSearchResultSerializer,
result: grouped_results,
)
rescue Discourse::InvalidAccess
render_json_error(I18n.t("invalid_access"), status: 403)
end
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { SEARCH_TYPE_DEFAULT } from "discourse/controllers/full-page-search";
import concatClass from "discourse/helpers/concat-class";
import icon from "discourse/helpers/d-icon";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { isValidSearchTerm, translateResults } from "discourse/lib/search";
import { i18n } from "discourse-i18n";
import DTooltip from "float-kit/components/d-tooltip";
Expand Down Expand Up @@ -193,6 +194,7 @@ export default class AiFullPageSearch extends Component {

this.AiResults = model.posts;
})
.catch(popupAjaxError)
.finally(() => {
this.searching = false;
});
Expand Down