@@ -11,13 +11,9 @@ import { isValidSearchTerm, translateResults } from "discourse/lib/search";
1111import icon from " discourse-common/helpers/d-icon" ;
1212import I18n , { i18n } from " discourse-i18n" ;
1313import DTooltip from " float-kit/components/d-tooltip" ;
14- import AiIndicatorWave from " ../../components/ai-indicator-wave" ;
15-
16- export default class SemanticSearch extends Component {
17- static shouldRender (_args , { siteSettings }) {
18- return siteSettings .ai_embeddings_semantic_search_enabled ;
19- }
14+ import AiIndicatorWave from " ./ai-indicator-wave" ;
2015
16+ export default class AiFullPageSearch extends Component {
2117 @service appEvents;
2218 @service router;
2319 @service siteSettings;
@@ -26,8 +22,8 @@ export default class SemanticSearch extends Component {
2622 @tracked searching;
2723 @tracked AiResults = [];
2824 @tracked showingAiResults = false ;
29- @tracked sortOrder = this .args .outletArgs . sortOrder ;
30- initialSearchTerm = this .args .outletArgs . search ;
25+ @tracked sortOrder = this .args .sortOrder ;
26+ initialSearchTerm = this .args .searchTerm ;
3127
3228 constructor () {
3329 super (... arguments );
@@ -46,7 +42,7 @@ export default class SemanticSearch extends Component {
4642 return ;
4743 }
4844
49- this .initialSearchTerm = this .args .outletArgs . search ;
45+ this .initialSearchTerm = this .args .searchTerm ;
5046 this .searching = true ;
5147 this .resetAiResults ();
5248 return this .performHyDESearch ();
@@ -110,16 +106,16 @@ export default class SemanticSearch extends Component {
110106 }
111107
112108 get searchTerm () {
113- if (this .initialSearchTerm !== this .args .outletArgs . search ) {
109+ if (this .initialSearchTerm !== this .args .searchTerm ) {
114110 this .initialSearchTerm = undefined ;
115111 }
116112
117- return this .args .outletArgs . search ;
113+ return this .args .searchTerm ;
118114 }
119115
120116 get searchEnabled () {
121117 return (
122- this .args .outletArgs . type === SEARCH_TYPE_DEFAULT &&
118+ this .args .searchType === SEARCH_TYPE_DEFAULT &&
123119 isValidSearchTerm (this .searchTerm , this .siteSettings ) &&
124120 this .validSearchOrder
125121 );
@@ -128,9 +124,9 @@ export default class SemanticSearch extends Component {
128124 @action
129125 toggleAiResults () {
130126 if (this .showingAiResults ) {
131- this .args .outletArgs . addSearchResults ([], " topic_id" );
127+ this .args .addSearchResults ([], " topic_id" );
132128 } else {
133- this .args .outletArgs . addSearchResults (this .AiResults , " topic_id" );
129+ this .args .addSearchResults (this .AiResults , " topic_id" );
134130 }
135131 this .showingAiResults = ! this .showingAiResults ;
136132 }
@@ -139,7 +135,7 @@ export default class SemanticSearch extends Component {
139135 resetAiResults () {
140136 this .AiResults = [];
141137 this .showingAiResults = false ;
142- this .args .outletArgs . addSearchResults ([], " topic_id" );
138+ this .args .addSearchResults ([], " topic_id" );
143139 }
144140
145141 performHyDESearch () {
@@ -168,8 +164,8 @@ export default class SemanticSearch extends Component {
168164
169165 @action
170166 sortChanged () {
171- if (this .sortOrder !== this .args .outletArgs . sortOrder ) {
172- this .sortOrder = this .args .outletArgs . sortOrder ;
167+ if (this .sortOrder !== this .args .sortOrder ) {
168+ this .sortOrder = this .args .sortOrder ;
173169
174170 if (this .validSearchOrder ) {
175171 this .onSearch ();
@@ -181,7 +177,7 @@ export default class SemanticSearch extends Component {
181177 }
182178
183179 <template >
184- <span {{didUpdate this . sortChanged @ outletArgs. sortOrder}} ></span >
180+ <span {{didUpdate this . sortChanged @ sortOrder}} ></span >
185181 <div class =" semantic-search__container search-results" role =" region" >
186182 <div class =" semantic-search__results" >
187183 <div
0 commit comments