aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/services/indexsearch.ts
diff options
context:
space:
mode:
Diffstat (limited to 'viewer/src/services/indexsearch.ts')
-rw-r--r--viewer/src/services/indexsearch.ts7
1 files changed, 3 insertions, 4 deletions
diff --git a/viewer/src/services/indexsearch.ts b/viewer/src/services/indexsearch.ts
index a55a829..00f8cfc 100644
--- a/viewer/src/services/indexsearch.ts
+++ b/viewer/src/services/indexsearch.ts
@@ -20,7 +20,6 @@
20import { Operation } from "@/@types/Operation"; 20import { Operation } from "@/@types/Operation";
21 21
22export default class IndexSearch { 22export default class IndexSearch {
23
24 // Results of the search (by tags) 23 // Results of the search (by tags)
25 public static search(searchTags: Tag.Search[]): Gallery.Item[] { 24 public static search(searchTags: Tag.Search[]): Gallery.Item[] {
26 const byOperation = this.extractTagsByOperation(searchTags); 25 const byOperation = this.extractTagsByOperation(searchTags);
@@ -30,7 +29,7 @@ export default class IndexSearch {
30 } 29 }
31 30
32 private static extractTagsByOperation(searchTags: Tag.Search[]): Tag.SearchByOperation { 31 private static extractTagsByOperation(searchTags: Tag.Search[]): Tag.SearchByOperation {
33 let byOperation: Tag.SearchByOperation = {}; 32 const byOperation: Tag.SearchByOperation = {};
34 Object.values(Operation).forEach( 33 Object.values(Operation).forEach(
35 operation => (byOperation[operation] = searchTags.filter(tag => tag.operation === operation)) 34 operation => (byOperation[operation] = searchTags.filter(tag => tag.operation === operation))
36 ); 35 );
@@ -38,7 +37,7 @@ export default class IndexSearch {
38 } 37 }
39 38
40 private static extractIntersection(byOperation: Tag.SearchByOperation): Set<Gallery.Item> { 39 private static extractIntersection(byOperation: Tag.SearchByOperation): Set<Gallery.Item> {
41 let intersection = new Set<Gallery.Item>(); 40 const intersection = new Set<Gallery.Item>();
42 if (byOperation[Operation.INTERSECTION].length > 0) { 41 if (byOperation[Operation.INTERSECTION].length > 0) {
43 byOperation[Operation.INTERSECTION] 42 byOperation[Operation.INTERSECTION]
44 .map(tag => tag.items) 43 .map(tag => tag.items)
@@ -50,7 +49,7 @@ export default class IndexSearch {
50 } 49 }
51 50
52 private static extractSubstraction(byOperation: Tag.SearchByOperation): Set<Gallery.Item> { 51 private static extractSubstraction(byOperation: Tag.SearchByOperation): Set<Gallery.Item> {
53 let substraction = new Set<Gallery.Item>(); 52 const substraction = new Set<Gallery.Item>();
54 if (byOperation[Operation.SUBSTRACTION].length > 0) { 53 if (byOperation[Operation.SUBSTRACTION].length > 0) {
55 byOperation[Operation.SUBSTRACTION].flatMap(tag => tag.items).forEach(item => substraction.add(item)); 54 byOperation[Operation.SUBSTRACTION].flatMap(tag => tag.items).forEach(item => substraction.add(item));
56 } 55 }