Improved special character handling in manticore and URL query.

This commit is contained in:
2024-04-01 01:50:24 +02:00
parent 56e9d07b85
commit 6f371499d3
7 changed files with 21 additions and 8 deletions

View File

@@ -8,6 +8,7 @@ import { fetchActorsById, curateActor, sortActorsByGender } from './actors.js';
import { fetchTagsById } from './tags.js';
import { fetchEntitiesById } from './entities.js';
import { curateStash } from './stashes.js';
import escape from '../utils/escape-manticore.js';
import promiseProps from '../utils/promise-props.js';
function curateMedia(media) {
@@ -428,7 +429,7 @@ async function queryManticoreSql(filters, options, _reqUser) {
}
if (filters.query) {
builder.whereRaw('match(\'@!title :query:\', scenes)', { query: filters.query });
builder.whereRaw('match(\'@!title :query:\', scenes)', { query: escape(filters.query) });
}
filters.tagIds?.forEach((tagId) => {
@@ -492,8 +493,7 @@ async function queryManticoreSql(filters, options, _reqUser) {
}
})
.limit(options.limit)
.offset((options.page - 1) * options.limit)
.toString(),
.offset((options.page - 1) * options.limit),
// option threads=1 fixes actors, but drastically slows down performance, wait for fix
actorsFacet: options.aggregateActors ? knex.raw('facet scenes.actor_ids order by count(*) desc limit ?', [aggSize]) : null,
tagsFacet: options.aggregateTags ? knex.raw('facet scenes.tag_ids order by count(*) desc limit ?', [aggSize]) : null,