mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX Fixed SQL syntax error in MATCH AGAINST clause in FulltextFilter
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@77672 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
ce6402f8d0
commit
86388328a1
@ -29,7 +29,7 @@ class FulltextFilter extends SearchFilter {
|
|||||||
|
|
||||||
public function apply(SQLQuery $query) {
|
public function apply(SQLQuery $query) {
|
||||||
$query->where(sprintf(
|
$query->where(sprintf(
|
||||||
"MATCH (%s AGAINST ('%s')",
|
"MATCH (%s) AGAINST ('%s')",
|
||||||
$this->getDbName(),
|
$this->getDbName(),
|
||||||
Convert::raw2sql($this->getValue())
|
Convert::raw2sql($this->getValue())
|
||||||
));
|
));
|
||||||
|
@ -112,7 +112,8 @@ class SearchContextTest extends SapphireTest {
|
|||||||
"Negation" => "undisclosed",
|
"Negation" => "undisclosed",
|
||||||
"CollectionMatch" => "ExistingCollectionValue,NonExistingCollectionValue,4,Inline'Quotes'",
|
"CollectionMatch" => "ExistingCollectionValue,NonExistingCollectionValue,4,Inline'Quotes'",
|
||||||
"StartsWith" => "12345",
|
"StartsWith" => "12345",
|
||||||
"EndsWith" => "ijkl"
|
"EndsWith" => "ijkl",
|
||||||
|
"Fulltext" => "two"
|
||||||
);
|
);
|
||||||
|
|
||||||
$results = $context->getResults($params);
|
$results = $context->getResults($params);
|
||||||
@ -230,7 +231,8 @@ class SearchContextTest_AllFilterTypes extends DataObject implements TestOnly {
|
|||||||
"CollectionMatch" => "Varchar",
|
"CollectionMatch" => "Varchar",
|
||||||
"StartsWith" => "Varchar",
|
"StartsWith" => "Varchar",
|
||||||
"EndsWith" => "Varchar",
|
"EndsWith" => "Varchar",
|
||||||
"HiddenValue" => "Varchar"
|
"HiddenValue" => "Varchar",
|
||||||
|
'FulltextField' => 'Text',
|
||||||
);
|
);
|
||||||
|
|
||||||
static $searchable_fields = array(
|
static $searchable_fields = array(
|
||||||
@ -240,7 +242,8 @@ class SearchContextTest_AllFilterTypes extends DataObject implements TestOnly {
|
|||||||
"SubstringMatch" => "SubstringFilter",
|
"SubstringMatch" => "SubstringFilter",
|
||||||
"CollectionMatch" => "ExactMatchMultiFilter",
|
"CollectionMatch" => "ExactMatchMultiFilter",
|
||||||
"StartsWith" => "StartsWithFilter",
|
"StartsWith" => "StartsWithFilter",
|
||||||
"EndsWith" => "EndsWithFilter"
|
"EndsWith" => "EndsWithFilter",
|
||||||
|
"FulltextField" => "FulltextFilter",
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -64,4 +64,5 @@ SearchContextTest_AllFilterTypes:
|
|||||||
HiddenValue: Filtered value
|
HiddenValue: Filtered value
|
||||||
CollectionMatch: ExistingCollectionValue
|
CollectionMatch: ExistingCollectionValue
|
||||||
StartsWith: 12345-6789
|
StartsWith: 12345-6789
|
||||||
EndsWith: abcd-efgh-ijkl
|
EndsWith: abcd-efgh-ijkl
|
||||||
|
FulltextField: one two three
|
Loading…
x
Reference in New Issue
Block a user