mirror of
https://github.com/standardebooks/web.git
synced 2025-07-07 07:10:29 -04:00
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:
parent
fd3abb568c
commit
61bbf8f071
2 changed files with 3 additions and 2 deletions
|
@ -33,5 +33,6 @@ CREATE TABLE IF NOT EXISTS `Ebooks` (
|
||||||
FULLTEXT `idxSearch` (`IndexableText`),
|
FULLTEXT `idxSearch` (`IndexableText`),
|
||||||
FULLTEXT `idxSearchTitle` (`Title`),
|
FULLTEXT `idxSearchTitle` (`Title`),
|
||||||
FULLTEXT `idxSearchAuthors` (`IndexableAuthors`),
|
FULLTEXT `idxSearchAuthors` (`IndexableAuthors`),
|
||||||
FULLTEXT `idxSearchCollections` (`IndexableCollections`)
|
FULLTEXT `idxSearchCollections` (`IndexableCollections`),
|
||||||
|
FULLTEXT `idxSearchCombined` (`IndexableText`, `Title`, `IndexableAuthors`, `IndexableCollections`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
|
@ -2481,7 +2481,7 @@ final class Ebook{
|
||||||
match(e.IndexableText) against (?)
|
match(e.IndexableText) against (?)
|
||||||
) as RelevanceScore ';
|
) as RelevanceScore ';
|
||||||
|
|
||||||
$whereCondition .= ' and match(e.IndexableText) against(?) ';
|
$whereCondition .= ' and match(e.IndexableText, e.Title, e.IndexableAuthors, e.IndexableCollections) against(?) ';
|
||||||
$params[] = $query;
|
$params[] = $query;
|
||||||
|
|
||||||
if($sort == null || $sort == Enums\EbookSortType::Relevance || $sort == Enums\EbookSortType::Newest){
|
if($sort == null || $sort == Enums\EbookSortType::Relevance || $sort == Enums\EbookSortType::Newest){
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue