Add idxSearchCombined to match multiple fields

The data in these fields are separate:

* `IndexableText`
* `Title`
* `IndexableAuthors`
* `IndexableCollections`

There are also on indices on each of these fields so that they can have
separate weight in the relevance scoring.
This commit is contained in:
Mike Colagrosso 2025-02-06 14:52:13 -07:00 committed by Alex Cabal
parent fd3abb568c
commit 61bbf8f071
2 changed files with 3 additions and 2 deletions

View file

@ -33,5 +33,6 @@ CREATE TABLE IF NOT EXISTS `Ebooks` (
FULLTEXT `idxSearch` (`IndexableText`),
FULLTEXT `idxSearchTitle` (`Title`),
FULLTEXT `idxSearchAuthors` (`IndexableAuthors`),
FULLTEXT `idxSearchCollections` (`IndexableCollections`)
FULLTEXT `idxSearchCollections` (`IndexableCollections`),
FULLTEXT `idxSearchCombined` (`IndexableText`, `Title`, `IndexableAuthors`, `IndexableCollections`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

View file

@ -2481,7 +2481,7 @@ final class Ebook{
match(e.IndexableText) against (?)
) as RelevanceScore ';
$whereCondition .= ' and match(e.IndexableText) against(?) ';
$whereCondition .= ' and match(e.IndexableText, e.Title, e.IndexableAuthors, e.IndexableCollections) against(?) ';
$params[] = $query;
if($sort == null || $sort == Enums\EbookSortType::Relevance || $sort == Enums\EbookSortType::Newest){