Bug #67843
closedEpic #65814: Make Indexed search extbase plugin shine
Wrong queries in indexSearchRepository
100%
Description
Duplicate 'AND' in IndexSearchRepository.php
Line 562 and 627 both add a 'AND' string so the final query contains 'AND AND' and gets invalid.
The pi-based version of indexed search does not contain 'AND' in function execFinalQuery (SearchFormController.php line 1108)
There is something wrong with the implode function in statement
$wordSel = '(' . implode(' OR ', $this->wSelClauses) . ') AND ';
in line 614 in IndexSearchRepository.php
Implode returns double ORs ('OR OR'). Therefore the query gets invalid.
There are only search results for the first item in defaultFreeIndexUidList.
Other items return "no result" even if there are some.
Files
Updated by Tymoteusz Motylewski over 9 years ago
Issue originally reported by Gerhard Rupp
Updated by Tymoteusz Motylewski over 9 years ago
How can I reproduce the issue?
What TYPO3 version are you using?
I have checked the current 6.2 and 7 branch and it looks ok by reading.
Updated by Gerhard Rupp over 9 years ago
- Target version set to 6.2.14
'AND' issue:
- Compare the "original" line in function execFinalQuery of th pi-based version of indexed search: There is no 'AND' in line 1108
'OR' issue:
- both lines of pi-based and extbased version are identical
- but if you do a var_dump of $wordSel you get double ORs
Updated by Manuel Link over 9 years ago
After some more testing I can add some further information:
- due to testing several different versions we accidentally ended up with a slightly outdated version, the 'AND' issue has been resolved in the current 6.2 version
- the 'OR' issue is a result of using '$this->wSelClauses' in the sql-statement without filling it properly. Currently it only gets filled with empty strings (one for each search word).
- we tried going back to the old behaviour of filling it like in the pi-based version, works nice so far.
- when using this method for following items in the 'defaultFreeIndexUidList' the array '$this->wSelClauses' is filled repeatedly with the same values, so I think it should be cleared at the beginning of 'getPhashList'. This isn't really necessary, since the resulting query has the same result, but I think it might break the function in some configurations. (this should probably also be changed in the pi-based version)
attaching a patch file for the changes to 6.2
Updated by Alexander Opitz over 9 years ago
- Target version changed from 6.2.14 to 6.2.15
Updated by Alexander Opitz over 9 years ago
@Manuel
Would you like to bring your patch into gerrit for master?
Updated by Tymoteusz Motylewski over 9 years ago
@Manuel, @Gerhard Can you guide me how can I reproduce the issue?
I mean, what plugin configuration should I have, what should I choose in the indexed search advanced search options?
I need that to verify whether the patch solves the issue.
Updated by Manuel Link over 9 years ago
Just reproduced it with a fresh 6.2.14 page with the introduction package.
All you need to do is include the standard "Indexed Search (experimental)" typoscript and start an advanced search with "Order by:" set to a value that starts with "rank_", e.g. "Weight/Frequency".
Now searching for one Word will result in "() AND " for "$wordSel", which is at the start of the select clause.
For two words it will be "( OR ) AND " and so on...
I hope this helps reproducing the issue.
Updated by Gerrit Code Review over 9 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42219
Updated by Gerrit Code Review over 9 years ago
Patch set 1 for branch TYPO3_7-0 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42220
Updated by Gerrit Code Review over 9 years ago
Patch set 1 for branch TYPO3_7-3 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42221
Updated by Gerrit Code Review over 9 years ago
Patch set 1 for branch TYPO3_7-3 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42221
Updated by Gerrit Code Review over 9 years ago
Patch set 2 for branch TYPO3_7-3 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42221
Updated by Gerrit Code Review over 9 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42219
Updated by Gerrit Code Review over 9 years ago
Patch set 2 for branch TYPO3_7-0 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42220
Updated by Gerrit Code Review over 9 years ago
Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42222
Updated by Gerrit Code Review over 9 years ago
Patch set 2 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42222
Updated by Gerrit Code Review over 9 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42219
Updated by Anonymous over 9 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 242ce5bd77a958beb0d5a0723708b591856c6eee.
Updated by Gerrit Code Review over 9 years ago
- Status changed from Resolved to Under Review
Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/42670
Updated by Anonymous over 9 years ago
- Status changed from Under Review to Resolved
Applied in changeset 61b3b3a7bbb8f1720b8d6dd98ea052e7c834bac2.
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed