mirror of
https://github.com/xuthus83/pigallery2.git
synced 2025-01-14 14:43:17 +08:00
Creates a settings that can enable and disable directories in search result
This commit is contained in:
parent
90aff86485
commit
a33f983d16
@ -181,24 +181,26 @@ export class SearchManager implements ISearchManager {
|
||||
result.resultOverflow = true;
|
||||
}
|
||||
|
||||
const dirQuery = this.filterDirectoryQuery(query);
|
||||
if (dirQuery !== null) {
|
||||
result.directories = await connection
|
||||
.getRepository(DirectoryEntity)
|
||||
.createQueryBuilder('directory')
|
||||
.where(this.buildWhereQuery(dirQuery, true))
|
||||
.limit(Config.Client.Search.maxDirectoryResult + 1)
|
||||
.getMany();
|
||||
if (Config.Client.Search.listDirectories === true) {
|
||||
const dirQuery = this.filterDirectoryQuery(query);
|
||||
if (dirQuery !== null) {
|
||||
result.directories = await connection
|
||||
.getRepository(DirectoryEntity)
|
||||
.createQueryBuilder('directory')
|
||||
.where(this.buildWhereQuery(dirQuery, true))
|
||||
.limit(Config.Client.Search.maxDirectoryResult + 1)
|
||||
.getMany();
|
||||
|
||||
// setting previews
|
||||
if (result.directories) {
|
||||
for (const item of result.directories) {
|
||||
await (ObjectManagers.getInstance().GalleryManager as ISQLGalleryManager)
|
||||
.fillPreviewForSubDir(connection, item as DirectoryEntity);
|
||||
// setting previews
|
||||
if (result.directories) {
|
||||
for (const item of result.directories) {
|
||||
await (ObjectManagers.getInstance().GalleryManager as ISQLGalleryManager)
|
||||
.fillPreviewForSubDir(connection, item as DirectoryEntity);
|
||||
}
|
||||
}
|
||||
if (result.directories.length > Config.Client.Search.maxDirectoryResult) {
|
||||
result.resultOverflow = true;
|
||||
}
|
||||
}
|
||||
if (result.directories.length > Config.Client.Search.maxDirectoryResult) {
|
||||
result.resultOverflow = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,8 @@ export class ClientSearchConfig {
|
||||
AutoComplete: AutoCompleteConfig = new AutoCompleteConfig();
|
||||
@ConfigProperty({type: 'unsignedInt'})
|
||||
maxMediaResult: number = 10000;
|
||||
@ConfigProperty({description: 'Search returns also with directories, not just media'})
|
||||
listDirectories: boolean = false;
|
||||
@ConfigProperty({type: 'unsignedInt'})
|
||||
maxDirectoryResult: number = 200;
|
||||
}
|
||||
|
@ -44,6 +44,13 @@
|
||||
required="true">
|
||||
</app-settings-entry>
|
||||
|
||||
<app-settings-entry
|
||||
name="List directories"
|
||||
description="Search will also return with directories"
|
||||
i18n-description i18n-name
|
||||
[ngModel]="states.listDirectories"
|
||||
[simplifiedMode]="simplifiedMode">
|
||||
</app-settings-entry>
|
||||
|
||||
|
||||
|
||||
|
@ -2772,6 +2772,18 @@
|
||||
<source>Maximum number of photos and videos that listed in one search result.</source>
|
||||
<target>Maximum number of photos and videos that listed in one search result.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="3200342440195656274" datatype="html">
|
||||
<source>Insert</source>
|
||||
<target>Insert</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="5788628366491057479" datatype="html">
|
||||
<source>List directories"</source>
|
||||
<target>List directories"</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="1627438365479766712" datatype="html">
|
||||
<source>Search will also return with directories"</source>
|
||||
<target>Search will also return with directories"</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
@ -2772,6 +2772,18 @@
|
||||
<source>Maximum number of photos and videos that listed in one search result.</source>
|
||||
<target>Maximum number of photos and videos that listed in one search result.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="3200342440195656274" datatype="html">
|
||||
<source>Insert</source>
|
||||
<target>Insert</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="5788628366491057479" datatype="html">
|
||||
<source>List directories"</source>
|
||||
<target>List directories"</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="1627438365479766712" datatype="html">
|
||||
<source>Search will also return with directories"</source>
|
||||
<target>Search will also return with directories"</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
@ -2772,6 +2772,18 @@
|
||||
<source>Maximum number of photos and videos that listed in one search result.</source>
|
||||
<target>Maximum number of photos and videos that listed in one search result.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="3200342440195656274" datatype="html">
|
||||
<source>Insert</source>
|
||||
<target>Insert</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="5788628366491057479" datatype="html">
|
||||
<source>List directories"</source>
|
||||
<target>List directories"</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="1627438365479766712" datatype="html">
|
||||
<source>Search will also return with directories"</source>
|
||||
<target>Search will also return with directories"</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
@ -2772,6 +2772,18 @@
|
||||
<source>Maximum number of photos and videos that listed in one search result.</source>
|
||||
<target>Maximálisan ennyi képet és mappát listáz ki egy keresési eredménnyel</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="3200342440195656274" datatype="html">
|
||||
<source>Insert</source>
|
||||
<target>Beillesztés</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="5788628366491057479" datatype="html">
|
||||
<source>List directories"</source>
|
||||
<target>Mappák listázása"</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="1627438365479766712" datatype="html">
|
||||
<source>Search will also return with directories"</source>
|
||||
<target>A keresési eredmény mappákat is fog tartalmazni"</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
|
@ -2772,6 +2772,18 @@
|
||||
<source>Maximum number of photos and videos that listed in one search result.</source>
|
||||
<target>Maximum number of photos and videos that listed in one search result.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="3200342440195656274" datatype="html">
|
||||
<source>Insert</source>
|
||||
<target>Insert</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="5788628366491057479" datatype="html">
|
||||
<source>List directories"</source>
|
||||
<target>List directories"</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="1627438365479766712" datatype="html">
|
||||
<source>Search will also return with directories"</source>
|
||||
<target>Search will also return with directories"</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
@ -2772,6 +2772,18 @@
|
||||
<source>Maximum number of photos and videos that listed in one search result.</source>
|
||||
<target>Maximum number of photos and videos that listed in one search result.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="3200342440195656274" datatype="html">
|
||||
<source>Insert</source>
|
||||
<target>Insert</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="5788628366491057479" datatype="html">
|
||||
<source>List directories"</source>
|
||||
<target>List directories"</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="1627438365479766712" datatype="html">
|
||||
<source>Search will also return with directories"</source>
|
||||
<target>Search will also return with directories"</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
@ -2772,6 +2772,18 @@
|
||||
<source>Maximum number of photos and videos that listed in one search result.</source>
|
||||
<target>Maximum number of photos and videos that listed in one search result.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="3200342440195656274" datatype="html">
|
||||
<source>Insert</source>
|
||||
<target>Insert</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="5788628366491057479" datatype="html">
|
||||
<source>List directories"</source>
|
||||
<target>List directories"</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="1627438365479766712" datatype="html">
|
||||
<source>Search will also return with directories"</source>
|
||||
<target>Search will also return with directories"</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
@ -2772,6 +2772,18 @@
|
||||
<source>Maximum number of photos and videos that listed in one search result.</source>
|
||||
<target>Maximum number of photos and videos that listed in one search result.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="3200342440195656274" datatype="html">
|
||||
<source>Insert</source>
|
||||
<target>Insert</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="5788628366491057479" datatype="html">
|
||||
<source>List directories"</source>
|
||||
<target>List directories"</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="1627438365479766712" datatype="html">
|
||||
<source>Search will also return with directories"</source>
|
||||
<target>Search will also return with directories"</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
@ -2772,6 +2772,18 @@
|
||||
<source>Maximum number of photos and videos that listed in one search result.</source>
|
||||
<target>Maximum number of photos and videos that listed in one search result.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="3200342440195656274" datatype="html">
|
||||
<source>Insert</source>
|
||||
<target>Insert</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="5788628366491057479" datatype="html">
|
||||
<source>List directories"</source>
|
||||
<target>List directories"</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="1627438365479766712" datatype="html">
|
||||
<source>Search will also return with directories"</source>
|
||||
<target>Search will also return with directories"</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
@ -117,12 +117,14 @@ describe('SearchManager', (sqlHelper: DBTestHelper) => {
|
||||
|
||||
|
||||
before(async () => {
|
||||
Config.Client.Search.listDirectories = true;
|
||||
await setUpSqlDB();
|
||||
});
|
||||
|
||||
|
||||
after(async () => {
|
||||
await sqlHelper.clearDB();
|
||||
Config.Client.Search.listDirectories = false;
|
||||
});
|
||||
|
||||
it('should get autocomplete', async () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user