@@ -36,7 +36,7 @@ public static function getOpenApiParameters(ApiFilter $apiFilter): array
3636 */
3737 public function filterProperty (
3838 string $ property ,
39- $ values ,
39+ $ values ,
4040 QueryInterface $ query ,
4141 ApiFilter $ apiFilter
4242 ): ?ConstraintInterface {
@@ -82,7 +82,6 @@ protected function matchAgainstFindIds(
8282 $ binds = [];
8383 $ rootAlias = 'o ' ;
8484 $ queryExpansion = (bool )$ apiFilter ->getArgument ('withQueryExpansion ' );
85- $ booleanQuery = (bool )$ apiFilter ->getArgument ('withBooleanQuery ' );
8685
8786 $ queryBuilder = GeneralUtility::makeInstance (ConnectionPool::class)
8887 ->getQueryBuilderForTable ($ tableName );
@@ -101,43 +100,16 @@ protected function matchAgainstFindIds(
101100
102101 foreach ($ values as $ i => $ value ) {
103102 $ key = ':text_ma_ ' . ((int )$ i );
104-
105- if ($ booleanQuery ) {
106- // Split the value into individual words and create OR conditions
107- $ words = explode (' ' , trim ($ value ));
108- $ booleanQuery = '' ;
109- foreach ($ words as $ word ) {
110- if (!empty (trim ($ word ))) {
111- $ booleanQuery .= ' + ' . trim ($ word ) . '* ' ;
112- }
113- }
114- $ booleanQuery = trim ($ booleanQuery );
115-
116- // use IN BOOLEAN MODE to search for partials of words
117- $ conditions [] = sprintf (
118- 'MATCH(%s) AGAINST (%s IN BOOLEAN MODE) ' ,
119- $ queryBuilder ->quoteIdentifier (
120- $ tableAlias . '. ' . GeneralUtility::makeInstance (DataMapper::class)
121- ->convertPropertyNameToColumnName ($ propertyName , $ apiFilter ->getFilterClass ())
122- ),
123- $ key
124- );
125-
126- $ binds [ltrim ($ key , ': ' )] = $ booleanQuery ;
127- } else {
128- // Original natural language mode query
129- $ conditions [] = sprintf (
130- 'MATCH(%s) AGAINST (%s IN NATURAL LANGUAGE MODE %s) ' ,
131- $ queryBuilder ->quoteIdentifier (
132- $ tableAlias . '. ' . GeneralUtility::makeInstance (DataMapper::class)
133- ->convertPropertyNameToColumnName ($ propertyName , $ apiFilter ->getFilterClass ())
134- ),
135- $ key ,
136- $ queryExpansion ? ' WITH QUERY EXPANSION ' : ''
137- );
138-
139- $ binds [ltrim ($ key , ': ' )] = $ value ;
140- }
103+ $ conditions [] = sprintf (
104+ 'MATCH(%s) AGAINST (%s IN NATURAL LANGUAGE MODE %s) ' ,
105+ $ queryBuilder ->quoteIdentifier (
106+ $ tableAlias . '. ' . GeneralUtility::makeInstance (DataMapper::class)
107+ ->convertPropertyNameToColumnName ($ propertyName , $ apiFilter ->getFilterClass ())
108+ ),
109+ $ key ,
110+ $ queryExpansion ? ' WITH QUERY EXPANSION ' : ''
111+ );
112+ $ binds [ltrim ($ key , ': ' )] = $ value ;
141113 }
142114
143115 return $ queryBuilder
0 commit comments