mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #4682 from open-sausages/features/dbfile-file
BUG Fix regressions in fulltextsearch
This commit is contained in:
commit
43b19f2d23
@ -129,7 +129,7 @@ class MySQLDatabase extends SS_Database {
|
|||||||
MATCH (Title, MenuTitle, Content, MetaDescription) AGAINST ('$keywords' $boolean)
|
MATCH (Title, MenuTitle, Content, MetaDescription) AGAINST ('$keywords' $boolean)
|
||||||
+ MATCH (Title, MenuTitle, Content, MetaDescription) AGAINST ('$htmlEntityKeywords' $boolean)
|
+ MATCH (Title, MenuTitle, Content, MetaDescription) AGAINST ('$htmlEntityKeywords' $boolean)
|
||||||
";
|
";
|
||||||
$match['File'] = "MATCH (Filename, Title, Content) AGAINST ('$keywords' $boolean) AND ClassName = 'File'";
|
$match['File'] = "MATCH (Name, Title) AGAINST ('$keywords' $boolean) AND ClassName = 'File'";
|
||||||
|
|
||||||
// We make the relevance search by converting a boolean mode search into a normal one
|
// We make the relevance search by converting a boolean mode search into a normal one
|
||||||
$relevanceKeywords = str_replace(array('*', '+', '-'), '', $keywords);
|
$relevanceKeywords = str_replace(array('*', '+', '-'), '', $keywords);
|
||||||
@ -137,7 +137,7 @@ class MySQLDatabase extends SS_Database {
|
|||||||
$relevance['SiteTree'] = "MATCH (Title, MenuTitle, Content, MetaDescription) "
|
$relevance['SiteTree'] = "MATCH (Title, MenuTitle, Content, MetaDescription) "
|
||||||
. "AGAINST ('$relevanceKeywords') "
|
. "AGAINST ('$relevanceKeywords') "
|
||||||
. "+ MATCH (Title, MenuTitle, Content, MetaDescription) AGAINST ('$htmlEntityRelevanceKeywords')";
|
. "+ MATCH (Title, MenuTitle, Content, MetaDescription) AGAINST ('$htmlEntityRelevanceKeywords')";
|
||||||
$relevance['File'] = "MATCH (Filename, Title, Content) AGAINST ('$relevanceKeywords')";
|
$relevance['File'] = "MATCH (Name, Title) AGAINST ('$relevanceKeywords')";
|
||||||
} else {
|
} else {
|
||||||
$relevance['SiteTree'] = $relevance['File'] = 1;
|
$relevance['SiteTree'] = $relevance['File'] = 1;
|
||||||
$match['SiteTree'] = $match['File'] = "1 = 1";
|
$match['SiteTree'] = $match['File'] = "1 = 1";
|
||||||
@ -157,14 +157,14 @@ class MySQLDatabase extends SS_Database {
|
|||||||
"ClassName", "$baseClasses[SiteTree].\"ID\"", "ParentID",
|
"ClassName", "$baseClasses[SiteTree].\"ID\"", "ParentID",
|
||||||
"Title", "MenuTitle", "URLSegment", "Content",
|
"Title", "MenuTitle", "URLSegment", "Content",
|
||||||
"LastEdited", "Created",
|
"LastEdited", "Created",
|
||||||
"Filename" => "_utf8''", "Name" => "_utf8''",
|
"Name" => "_utf8''",
|
||||||
"Relevance" => $relevance['SiteTree'], "CanViewType"
|
"Relevance" => $relevance['SiteTree'], "CanViewType"
|
||||||
),
|
),
|
||||||
'File' => array(
|
'File' => array(
|
||||||
"ClassName", "$baseClasses[File].\"ID\"", "ParentID" => "_utf8''",
|
"ClassName", "$baseClasses[File].\"ID\"", "ParentID" => "_utf8''",
|
||||||
"Title", "MenuTitle" => "_utf8''", "URLSegment" => "_utf8''", "Content",
|
"Title", "MenuTitle" => "_utf8''", "URLSegment" => "_utf8''", "Content" => "_utf8''",
|
||||||
"LastEdited", "Created",
|
"LastEdited", "Created",
|
||||||
"Filename", "Name",
|
"Name",
|
||||||
"Relevance" => $relevance['File'], "CanViewType" => "NULL"
|
"Relevance" => $relevance['File'], "CanViewType" => "NULL"
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -44,7 +44,7 @@ class FulltextSearchable extends DataExtension {
|
|||||||
public static function enable($searchableClasses = array('SiteTree', 'File')) {
|
public static function enable($searchableClasses = array('SiteTree', 'File')) {
|
||||||
$defaultColumns = array(
|
$defaultColumns = array(
|
||||||
'SiteTree' => '"Title","MenuTitle","Content","MetaDescription"',
|
'SiteTree' => '"Title","MenuTitle","Content","MetaDescription"',
|
||||||
'File' => '"Title","Filename","Content"'
|
'File' => '"Name","Title"'
|
||||||
);
|
);
|
||||||
|
|
||||||
if(!is_array($searchableClasses)) $searchableClasses = array($searchableClasses);
|
if(!is_array($searchableClasses)) $searchableClasses = array($searchableClasses);
|
||||||
|
Loading…
Reference in New Issue
Block a user