mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-01-20 04:59:33 +02:00
Fixing search result to include directory preview fixes #411
This commit is contained in:
parent
5f6c8323c7
commit
3982250d64
@ -205,7 +205,13 @@ export class SearchManager implements ISQLSearchManager {
|
||||
.getRepository(DirectoryEntity)
|
||||
.createQueryBuilder('directory')
|
||||
.where(this.buildWhereQuery(dirQuery, true))
|
||||
.leftJoinAndSelect('directory.preview', 'preview')
|
||||
.leftJoinAndSelect('preview.directory', 'previewDirectory')
|
||||
.limit(Config.Client.Search.maxDirectoryResult + 1)
|
||||
.select(['directory',
|
||||
'preview.name',
|
||||
'previewDirectory.name',
|
||||
'previewDirectory.path'])
|
||||
.getMany();
|
||||
|
||||
// setting previews
|
||||
|
@ -27,7 +27,6 @@ import {TestHelper} from './TestHelper';
|
||||
import {ObjectManagers} from '../../../../../src/backend/model/ObjectManagers';
|
||||
import {GalleryManager} from '../../../../../src/backend/model/database/sql/GalleryManager';
|
||||
import {Connection} from 'typeorm';
|
||||
import {DirectoryEntity} from '../../../../../src/backend/model/database/sql/enitites/DirectoryEntity';
|
||||
import {GPSMetadata, PhotoDTO, PhotoMetadata} from '../../../../../src/common/entities/PhotoDTO';
|
||||
import {VideoDTO} from '../../../../../src/common/entities/VideoDTO';
|
||||
import {AutoCompleteItem} from '../../../../../src/common/entities/AutoCompleteItem';
|
||||
@ -230,8 +229,6 @@ describe('SearchManager', (sqlHelper: DBTestHelper) => {
|
||||
const tmpMT = d.metaFile;
|
||||
delete d.directories;
|
||||
delete d.media;
|
||||
delete d.preview;
|
||||
delete d.validPreview;
|
||||
delete d.metaFile;
|
||||
const ret = Utils.clone(d);
|
||||
d.directories = tmpD;
|
||||
@ -1232,6 +1229,17 @@ describe('SearchManager', (sqlHelper: DBTestHelper) => {
|
||||
Config.Client.Search.listDirectories = true;
|
||||
const sm = new SearchManager();
|
||||
|
||||
const cloned = Utils.clone(searchifyDir(subDir));
|
||||
cloned.validPreview = true;
|
||||
cloned.preview = {
|
||||
directory: {
|
||||
name: subDir.name,
|
||||
path: subDir.path
|
||||
},
|
||||
name: pFaceLess.name,
|
||||
readyIcon: false,
|
||||
readyThumbnails: []
|
||||
} as any;
|
||||
const query = {
|
||||
text: subDir.name,
|
||||
type: SearchQueryTypes.any_text
|
||||
@ -1239,7 +1247,7 @@ describe('SearchManager', (sqlHelper: DBTestHelper) => {
|
||||
expect(removeDir(await sm.search(query)))
|
||||
.to.deep.equalInAnyOrder(removeDir({
|
||||
searchQuery: query,
|
||||
directories: [subDir],
|
||||
directories: [cloned],
|
||||
media: [pFaceLess],
|
||||
metaFile: [],
|
||||
resultOverflow: false
|
||||
|
Loading…
x
Reference in New Issue
Block a user