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:
Ingo Schommer 2009-05-24 21:27:48 +00:00
parent ce6402f8d0
commit 86388328a1
3 changed files with 9 additions and 5 deletions

View File

@ -29,7 +29,7 @@ class FulltextFilter extends SearchFilter {
public function apply(SQLQuery $query) {
$query->where(sprintf(
"MATCH (%s AGAINST ('%s')",
"MATCH (%s) AGAINST ('%s')",
$this->getDbName(),
Convert::raw2sql($this->getValue())
));

View File

@ -112,7 +112,8 @@ class SearchContextTest extends SapphireTest {
"Negation" => "undisclosed",
"CollectionMatch" => "ExistingCollectionValue,NonExistingCollectionValue,4,Inline'Quotes'",
"StartsWith" => "12345",
"EndsWith" => "ijkl"
"EndsWith" => "ijkl",
"Fulltext" => "two"
);
$results = $context->getResults($params);
@ -230,7 +231,8 @@ class SearchContextTest_AllFilterTypes extends DataObject implements TestOnly {
"CollectionMatch" => "Varchar",
"StartsWith" => "Varchar",
"EndsWith" => "Varchar",
"HiddenValue" => "Varchar"
"HiddenValue" => "Varchar",
'FulltextField' => 'Text',
);
static $searchable_fields = array(
@ -240,7 +242,8 @@ class SearchContextTest_AllFilterTypes extends DataObject implements TestOnly {
"SubstringMatch" => "SubstringFilter",
"CollectionMatch" => "ExactMatchMultiFilter",
"StartsWith" => "StartsWithFilter",
"EndsWith" => "EndsWithFilter"
"EndsWith" => "EndsWithFilter",
"FulltextField" => "FulltextFilter",
);
}

View File

@ -64,4 +64,5 @@ SearchContextTest_AllFilterTypes:
HiddenValue: Filtered value
CollectionMatch: ExistingCollectionValue
StartsWith: 12345-6789
EndsWith: abcd-efgh-ijkl
EndsWith: abcd-efgh-ijkl
FulltextField: one two three