mirror of
https://github.com/YGGverse/YGGo.git
synced 2025-01-24 13:34:25 +00:00
make meta fields index separated, set search priority by document title
This commit is contained in:
parent
5791877a4e
commit
662351cc46
@ -33,11 +33,15 @@ source hostPage : common
|
||||
CONCAT(`host`.`scheme`, '://', `host`.`name`, ':', `host`.`port`, `hostPage`.`uri`), \
|
||||
CONCAT(`host`.`scheme`, '://', `host`.`name`, `hostPage`.`uri`))), \
|
||||
REGEXP_REPLACE(`hostPage`.`mime`, '^([A-z-]+)/[A-z-]+.*', '$1') AS `mime`, \
|
||||
(SELECT GROUP_CONCAT(CONCAT_WS(' ', `hostPageDescription`.`title`, \
|
||||
`hostPageDescription`.`description`, \
|
||||
`hostPageDescription`.`keywords`)) \
|
||||
(SELECT GROUP_CONCAT(`hostPageDescription`.`title`) \
|
||||
FROM `hostPageDescription` \
|
||||
WHERE `hostPageDescription`.`hostPageId` = `hostPage`.`hostPageId`) AS `pageDescription` \
|
||||
WHERE `hostPageDescription`.`hostPageId` = `hostPage`.`hostPageId`) AS `title`, \
|
||||
(SELECT GROUP_CONCAT(`hostPageDescription`.`description`) \
|
||||
FROM `hostPageDescription` \
|
||||
WHERE `hostPageDescription`.`hostPageId` = `hostPage`.`hostPageId`) AS `description`, \
|
||||
(SELECT GROUP_CONCAT(`hostPageDescription`.`keywords`) \
|
||||
FROM `hostPageDescription` \
|
||||
WHERE `hostPageDescription`.`hostPageId` = `hostPage`.`hostPageId`) AS `keywords` \
|
||||
FROM `hostPage` \
|
||||
JOIN `host` ON (`host`.`hostId` = `hostPage`.`hostId`) \
|
||||
WHERE `host`.`status` = '1' AND `hostPage`.`httpCode` = 200 AND `hostPage`.`timeBanned` IS NULL AND `hostPage`.`mime` IS NOT NULL \
|
||||
|
@ -114,20 +114,17 @@ class Filter {
|
||||
$query = str_replace(['-', '_', '/'], ' ', $query);
|
||||
|
||||
// Apply query MATCH rules
|
||||
$words = [];
|
||||
|
||||
// URL request
|
||||
if (false !== strpos($query, '\:\ \ ')) {
|
||||
if (false !== strpos($query, '\:\ \ ')) { // URL request
|
||||
|
||||
$query = sprintf('"%s"', $crc32query);
|
||||
|
||||
// @TODO Queries longer than 68 chars unreachable in search index
|
||||
} else if (mb_strlen($query) > 68) {
|
||||
} else if (mb_strlen($query) > 68) { // @TODO Queries longer than 68 chars unreachable in search index
|
||||
|
||||
$query = sprintf('"%s" | (%s*)', $crc32query, substr($query, 0, 67));
|
||||
|
||||
// Default condition
|
||||
} else {
|
||||
} else { // Default condition
|
||||
|
||||
$words = [];
|
||||
|
||||
// Remove single char words
|
||||
foreach ((array) explode(' ', $query) as $word) {
|
||||
@ -138,14 +135,9 @@ class Filter {
|
||||
}
|
||||
}
|
||||
|
||||
if ($words) {
|
||||
|
||||
$query = implode(' | ', $words);
|
||||
}
|
||||
|
||||
$query = sprintf('"%s" | "%s" | %s', $query,
|
||||
$crc32query,
|
||||
$query);
|
||||
$query = sprintf('@title %s | "%s" | %s', $query,
|
||||
$crc32query,
|
||||
implode(' | ', $words));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user