aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/search
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/search')
-rw-r--r--client/src/app/search/advanced-search.model.ts18
-rw-r--r--client/src/app/search/search.component.html5
-rw-r--r--client/src/app/search/search.component.ts3
-rw-r--r--client/src/app/search/search.service.ts3
4 files changed, 21 insertions, 8 deletions
diff --git a/client/src/app/search/advanced-search.model.ts b/client/src/app/search/advanced-search.model.ts
index ce22c3f84..48616a9ae 100644
--- a/client/src/app/search/advanced-search.model.ts
+++ b/client/src/app/search/advanced-search.model.ts
@@ -99,14 +99,22 @@ export class AdvancedSearch {
99 startDate: this.startDate, 99 startDate: this.startDate,
100 endDate: this.endDate, 100 endDate: this.endDate,
101 nsfw: this.nsfw, 101 nsfw: this.nsfw,
102 categoryOneOf: this.categoryOneOf ? this.categoryOneOf.split(',') : undefined, 102 categoryOneOf: this.intoArray(this.categoryOneOf),
103 licenceOneOf: this.licenceOneOf ? this.licenceOneOf.split(',') : undefined, 103 licenceOneOf: this.intoArray(this.licenceOneOf),
104 languageOneOf: this.languageOneOf ? this.languageOneOf.split(',') : undefined, 104 languageOneOf: this.intoArray(this.languageOneOf),
105 tagsOneOf: this.tagsOneOf ? this.tagsOneOf.split(',') : undefined, 105 tagsOneOf: this.intoArray(this.tagsOneOf),
106 tagsAllOf: this.tagsAllOf ? this.tagsAllOf.split(',') : undefined, 106 tagsAllOf: this.intoArray(this.tagsAllOf),
107 durationMin: this.durationMin, 107 durationMin: this.durationMin,
108 durationMax: this.durationMax, 108 durationMax: this.durationMax,
109 sort: this.sort 109 sort: this.sort
110 } 110 }
111 } 111 }
112
113 private intoArray (value: any) {
114 if (!value) return undefined
115
116 if (typeof value === 'string') return value.split(',')
117
118 return [ value ]
119 }
112} 120}
diff --git a/client/src/app/search/search.component.html b/client/src/app/search/search.component.html
index a0b5e6e79..9d14daa4b 100644
--- a/client/src/app/search/search.component.html
+++ b/client/src/app/search/search.component.html
@@ -3,7 +3,10 @@
3 <div class="first-line"> 3 <div class="first-line">
4 <div class="results-counter"> 4 <div class="results-counter">
5 <ng-container *ngIf="pagination.totalItems"> 5 <ng-container *ngIf="pagination.totalItems">
6 {{ pagination.totalItems | myNumberFormatter }} results for <span class="search-value">{{ currentSearch }}</span> 6 {{ pagination.totalItems | myNumberFormatter }} results
7 <span *ngIf="currentSearch">
8 for <span class="search-value">{{ currentSearch }}</span>
9 </span>
7 </ng-container> 10 </ng-container>
8 </div> 11 </div>
9 12
diff --git a/client/src/app/search/search.component.ts b/client/src/app/search/search.component.ts
index 8860b9268..8d615fd05 100644
--- a/client/src/app/search/search.component.ts
+++ b/client/src/app/search/search.component.ts
@@ -44,7 +44,8 @@ export class SearchComponent implements OnInit, OnDestroy {
44 queryParams => { 44 queryParams => {
45 const querySearch = queryParams['search'] 45 const querySearch = queryParams['search']
46 46
47 if (!querySearch) return this.redirectService.redirectToHomepage() 47 // New empty search
48 if (this.currentSearch && !querySearch) return this.redirectService.redirectToHomepage()
48 49
49 // Search updated, reset filters 50 // Search updated, reset filters
50 if (this.currentSearch !== querySearch) { 51 if (this.currentSearch !== querySearch) {
diff --git a/client/src/app/search/search.service.ts b/client/src/app/search/search.service.ts
index b46cb97f4..a37c49161 100644
--- a/client/src/app/search/search.service.ts
+++ b/client/src/app/search/search.service.ts
@@ -36,7 +36,8 @@ export class SearchService {
36 36
37 let params = new HttpParams() 37 let params = new HttpParams()
38 params = this.restService.addRestGetParams(params, pagination) 38 params = this.restService.addRestGetParams(params, pagination)
39 params = params.append('search', search) 39
40 if (search) params = params.append('search', search)
40 41
41 const advancedSearchObject = advancedSearch.toAPIObject() 42 const advancedSearchObject = advancedSearch.toAPIObject()
42 43