diff options
author | pacien | 2020-09-25 16:01:49 +0200 |
---|---|---|
committer | pacien | 2020-09-25 16:01:49 +0200 |
commit | e93f7b1eb84c083d67567115284c0002a3a7d5fc (patch) | |
tree | 8d373e8f7f571485e1330928f43b090ed004c525 /viewer/src/services/indexsearch.ts | |
parent | 8e3ac8fe44bebb38e1882ca7f06b8100078ad88d (diff) | |
parent | fd542f75a1d94ee5f804d0925823276b97f38581 (diff) | |
download | ldgallery-e93f7b1eb84c083d67567115284c0002a3a7d5fc.tar.gz |
Merge branch 'develop' for release v2.0v2.0
Diffstat (limited to 'viewer/src/services/indexsearch.ts')
-rw-r--r-- | viewer/src/services/indexsearch.ts | 7 |
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 @@ | |||
20 | import { Operation } from "@/@types/Operation"; | 20 | import { Operation } from "@/@types/Operation"; |
21 | 21 | ||
22 | export default class IndexSearch { | 22 | export 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 | } |