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;
|
result.resultOverflow = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const dirQuery = this.filterDirectoryQuery(query);
|
if (Config.Client.Search.listDirectories === true) {
|
||||||
if (dirQuery !== null) {
|
const dirQuery = this.filterDirectoryQuery(query);
|
||||||
result.directories = await connection
|
if (dirQuery !== null) {
|
||||||
.getRepository(DirectoryEntity)
|
result.directories = await connection
|
||||||
.createQueryBuilder('directory')
|
.getRepository(DirectoryEntity)
|
||||||
.where(this.buildWhereQuery(dirQuery, true))
|
.createQueryBuilder('directory')
|
||||||
.limit(Config.Client.Search.maxDirectoryResult + 1)
|
.where(this.buildWhereQuery(dirQuery, true))
|
||||||
.getMany();
|
.limit(Config.Client.Search.maxDirectoryResult + 1)
|
||||||
|
.getMany();
|
||||||
|
|
||||||
// setting previews
|
// setting previews
|
||||||
if (result.directories) {
|
if (result.directories) {
|
||||||
for (const item of result.directories) {
|
for (const item of result.directories) {
|
||||||
await (ObjectManagers.getInstance().GalleryManager as ISQLGalleryManager)
|
await (ObjectManagers.getInstance().GalleryManager as ISQLGalleryManager)
|
||||||
.fillPreviewForSubDir(connection, item as DirectoryEntity);
|
.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();
|
AutoComplete: AutoCompleteConfig = new AutoCompleteConfig();
|
||||||
@ConfigProperty({type: 'unsignedInt'})
|
@ConfigProperty({type: 'unsignedInt'})
|
||||||
maxMediaResult: number = 10000;
|
maxMediaResult: number = 10000;
|
||||||
|
@ConfigProperty({description: 'Search returns also with directories, not just media'})
|
||||||
|
listDirectories: boolean = false;
|
||||||
@ConfigProperty({type: 'unsignedInt'})
|
@ConfigProperty({type: 'unsignedInt'})
|
||||||
maxDirectoryResult: number = 200;
|
maxDirectoryResult: number = 200;
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,13 @@
|
|||||||
required="true">
|
required="true">
|
||||||
</app-settings-entry>
|
</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>
|
<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>
|
<target>Maximum number of photos and videos that listed in one search result.</target>
|
||||||
</trans-unit>
|
</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>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
@ -2772,6 +2772,18 @@
|
|||||||
<source>Maximum number of photos and videos that listed in one search result.</source>
|
<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>
|
<target>Maximum number of photos and videos that listed in one search result.</target>
|
||||||
</trans-unit>
|
</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>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
@ -2772,6 +2772,18 @@
|
|||||||
<source>Maximum number of photos and videos that listed in one search result.</source>
|
<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>
|
<target>Maximum number of photos and videos that listed in one search result.</target>
|
||||||
</trans-unit>
|
</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>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
@ -2772,6 +2772,18 @@
|
|||||||
<source>Maximum number of photos and videos that listed in one search result.</source>
|
<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>
|
<target>Maximálisan ennyi képet és mappát listáz ki egy keresési eredménnyel</target>
|
||||||
</trans-unit>
|
</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>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
||||||
|
@ -2772,6 +2772,18 @@
|
|||||||
<source>Maximum number of photos and videos that listed in one search result.</source>
|
<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>
|
<target>Maximum number of photos and videos that listed in one search result.</target>
|
||||||
</trans-unit>
|
</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>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
@ -2772,6 +2772,18 @@
|
|||||||
<source>Maximum number of photos and videos that listed in one search result.</source>
|
<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>
|
<target>Maximum number of photos and videos that listed in one search result.</target>
|
||||||
</trans-unit>
|
</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>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
@ -2772,6 +2772,18 @@
|
|||||||
<source>Maximum number of photos and videos that listed in one search result.</source>
|
<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>
|
<target>Maximum number of photos and videos that listed in one search result.</target>
|
||||||
</trans-unit>
|
</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>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
@ -2772,6 +2772,18 @@
|
|||||||
<source>Maximum number of photos and videos that listed in one search result.</source>
|
<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>
|
<target>Maximum number of photos and videos that listed in one search result.</target>
|
||||||
</trans-unit>
|
</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>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
@ -2772,6 +2772,18 @@
|
|||||||
<source>Maximum number of photos and videos that listed in one search result.</source>
|
<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>
|
<target>Maximum number of photos and videos that listed in one search result.</target>
|
||||||
</trans-unit>
|
</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>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
@ -117,12 +117,14 @@ describe('SearchManager', (sqlHelper: DBTestHelper) => {
|
|||||||
|
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
|
Config.Client.Search.listDirectories = true;
|
||||||
await setUpSqlDB();
|
await setUpSqlDB();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
after(async () => {
|
after(async () => {
|
||||||
await sqlHelper.clearDB();
|
await sqlHelper.clearDB();
|
||||||
|
Config.Client.Search.listDirectories = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should get autocomplete', async () => {
|
it('should get autocomplete', async () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user