File tree Expand file tree Collapse file tree 2 files changed +2
-35
lines changed
resources/js/components/Search Expand file tree Collapse file tree 2 files changed +2
-35
lines changed Original file line number Diff line number Diff line change @@ -159,33 +159,6 @@ export default {
159159
160160 return extraFilters
161161 },
162-
163- getMiddlewares () {
164- let middlewares = InstantSearchMixin .methods .getMiddlewares .bind (this ).call ()
165-
166- const stateChanged = useDebounceFn ((changes ) => {
167- const query = Object .entries (changes .uiState ).find (([id , state ]) => {
168- return state? .query
169- })? .[1 ]? .query
170-
171- if (! query) {
172- return
173- }
174-
175- rapidezAPI (' post' , ' /search' , {
176- q: query,
177- })
178- }, 3000 )
179-
180- return [
181- ... middlewares,
182- () => ({
183- onStateChange (changes ) {
184- stateChanged (changes)
185- },
186- }),
187- ]
188- },
189162 },
190163}
191164< / script>
Original file line number Diff line number Diff line change @@ -40,23 +40,17 @@ public function track(Request $request): SearchQuery
4040 // Prevent automatic indexing each time it is updated.
4141 config ('rapidez.models.search_query ' )::disableSearchSyncing ();
4242 $ searchQuery = config ('rapidez.models.search_query ' )::withoutGlobalScope (IsActiveScope::class)
43- ->firstOrNew (
43+ ->firstOrCreate (
4444 [
4545 'query_text ' => Str::lower ($ request ->q ),
4646 'store_id ' => config ('rapidez.store ' ),
4747 ],
4848 [
4949 'num_results ' => $ request ->results ?? 0 ,
50- 'popularity ' => 1 ,
50+ 'popularity ' => 0 ,
5151 ]
5252 );
5353
54- if (! $ searchQuery ->exists ) {
55- $ searchQuery ->save ();
56-
57- return $ searchQuery ;
58- }
59-
6054 $ searchQuery ->popularity ++;
6155 if ($ request ->has ('results ' )) {
6256 $ searchQuery ->num_results = $ request ->results ;
You can’t perform that action at this time.
0 commit comments