1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

Fixing benchmark

This commit is contained in:
Patrik J. Braun 2023-08-01 23:04:04 +02:00
parent 0e460d07af
commit eccf84f3bc

View File

@ -28,7 +28,7 @@ import {
TextSearchQueryMatchTypes, TextSearchQueryMatchTypes,
TextSearchQueryTypes TextSearchQueryTypes
} from '../src/common/entities/SearchQueryDTO'; } from '../src/common/entities/SearchQueryDTO';
import {QueryKeywords, SearchQueryParser} from '../src/common/SearchQueryParser'; import {defaultQueryKeywords, QueryKeywords, SearchQueryParser} from '../src/common/SearchQueryParser';
import {ParentDirectoryDTO} from '../src/common/entities/DirectoryDTO'; import {ParentDirectoryDTO} from '../src/common/entities/DirectoryDTO';
@ -148,43 +148,7 @@ export class BenchmarkRunner {
async bmAllSearch(): Promise<{ result: BenchmarkResult[], searchQuery: SearchQueryDTO }[]> { async bmAllSearch(): Promise<{ result: BenchmarkResult[], searchQuery: SearchQueryDTO }[]> {
await this.setupDB(); await this.setupDB();
const queryKeywords: QueryKeywords = { const queryParser = new SearchQueryParser(defaultQueryKeywords);
NSomeOf: 'of',
and: 'and',
or: 'or',
from: 'after',
to: 'before',
landscape: 'landscape',
maxRating: 'max-rating',
maxResolution: 'max-resolution',
minRating: 'min-rating',
minResolution: 'min-resolution',
orientation: 'orientation',
years_ago: '%d-years-ago',
months_ago: '%d-months-ago',
weeks_ago: '%d-weeks-ago',
days_ago: '%d-days-ago',
every_year: 'every-year',
every_month: 'every-month',
every_week: 'every-week',
lastNDays: 'last-%d-days',
sameDay: 'same-day',
any_text: 'any-text',
keyword: 'keyword',
caption: 'caption',
directory: 'directory',
file_name: 'file-name',
person: 'person',
portrait: 'portrait',
position: 'position',
someOf: 'some-of',
kmFrom: 'km-from'
};
const queryParser = new SearchQueryParser(queryKeywords);
const names = (await ObjectManagers.getInstance().PersonManager.getAll()).sort((a, b) => b.count - a.count); const names = (await ObjectManagers.getInstance().PersonManager.getAll()).sort((a, b) => b.count - a.count);
const queries: { query: SearchQueryDTO, description: string }[] = TextSearchQueryTypes.map(t => { const queries: { query: SearchQueryDTO, description: string }[] = TextSearchQueryTypes.map(t => {
const q = { const q = {