Fixed MVA selection in scene query.
This commit is contained in:
parent
7a3fb84cf6
commit
27c17e9a3c
|
@ -406,9 +406,13 @@ async function queryManticoreSql(filters, options, _reqUser) {
|
||||||
builder.whereRaw('match(\'@!title :query:\', scenes)', { query: filters.query });
|
builder.whereRaw('match(\'@!title :query:\', scenes)', { query: filters.query });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filters.tagIds?.length > 0) {
|
filters.tagIds?.forEach((tagId) => {
|
||||||
builder.whereIn('any(tag_ids)', filters.tagIds);
|
builder.where('any(tag_ids)', tagId);
|
||||||
}
|
});
|
||||||
|
|
||||||
|
filters.actorIds?.forEach((actorId) => {
|
||||||
|
builder.where('any(actor_ids)', actorId);
|
||||||
|
});
|
||||||
|
|
||||||
if (filters.entityId) {
|
if (filters.entityId) {
|
||||||
builder.where((whereBuilder) => {
|
builder.where((whereBuilder) => {
|
||||||
|
@ -418,10 +422,6 @@ async function queryManticoreSql(filters, options, _reqUser) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filters.actorIds?.length > 0) {
|
|
||||||
builder.whereIn('any(actor_ids)', filters.actorIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof filters.isShowcased === 'boolean') {
|
if (typeof filters.isShowcased === 'boolean') {
|
||||||
builder.where('is_showcased', filters.isShowcased);
|
builder.where('is_showcased', filters.isShowcased);
|
||||||
}
|
}
|
||||||
|
@ -468,11 +468,15 @@ async function queryManticoreSql(filters, options, _reqUser) {
|
||||||
maxQueryTime: config.database.manticore.maxQueryTime,
|
maxQueryTime: config.database.manticore.maxQueryTime,
|
||||||
}).toString();
|
}).toString();
|
||||||
|
|
||||||
// manticore does not seem to accept table.column syntax if 'table' is primary (yet), crude work-around
|
// manticore does not seem to accept table.column syntax if 'table' is primary (yet?), crude work-around
|
||||||
const curatedSqlQuery = filters.stashId
|
const curatedSqlQuery = filters.stashId
|
||||||
? sqlQuery
|
? sqlQuery
|
||||||
: sqlQuery.replace(/scenes\./g, '');
|
: sqlQuery.replace(/scenes\./g, '');
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV === 'development') {
|
||||||
|
console.log(curatedSqlQuery);
|
||||||
|
}
|
||||||
|
|
||||||
const results = await utilsApi.sql(curatedSqlQuery);
|
const results = await utilsApi.sql(curatedSqlQuery);
|
||||||
|
|
||||||
// console.log(results);
|
// console.log(results);
|
||||||
|
|
Loading…
Reference in New Issue