Bug #67843

Epic #65814: Make Indexed search extbase plugin shine

Wrong queries in indexSearchRepository

Added by Tymoteusz Motylewski over 4 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Indexed Search
Target version:
Start date:
2015-06-30
Due date:
% Done:

100%

TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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.

indexed_search_wSelClauses.patch View (2.53 KB) Manuel Link, 2015-06-30 22:46


Related issues

Related to TYPO3 Core - Bug #38767: Incorrect order of search-result Closed 2012-07-09
Duplicated by TYPO3 Core - Bug #68667: Indexed Serach: Experimental plugin produces invalid SQL-queries Closed 2015-07-31

Associated revisions

Revision 242ce5bd (diff)
Added by Marc Neuhaus about 4 years ago

[BUGFIX] Fix QueryBuilding in IndexSearchRepository

This changeset fixes an issue in the indexSearchRepository that creates
invalid sql queries. Main issue is the missing of several wSelClauses,
that need to be collected, because they are imploded into the query.

Resolves: #67843
Releases: master, 6.2
Change-Id: Ib53b28660acfd92233de748431131f70e69f5125
Reviewed-on: http://review.typo3.org/42219
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>
Reviewed-by: Daniel Goerz <>
Tested-by: Daniel Goerz <>
Reviewed-by: Marc Neuhaus <>
Reviewed-by: Alexander Opitz <>
Tested-by: Alexander Opitz <>

Revision 61b3b3a7 (diff)
Added by Marc Neuhaus about 4 years ago

[BUGFIX] Fix QueryBuilding in IndexSearchRepository

This changeset fixes an issue in the indexSearchRepository that creates
invalid sql queries. Main issue is the missing of several wSelClauses,
that need to be collected, because they are imploded into the query.

Resolves: #67843
Releases: master, 6.2
Change-Id: Ib53b28660acfd92233de748431131f70e69f5125
Reviewed-on: http://review.typo3.org/42219
Reviewed-on: http://review.typo3.org/42670
Reviewed-by: Daniel Goerz <>
Reviewed-by: Marc Neuhaus <>
Tested-by: Marc Neuhaus <>
Reviewed-by: Wouter Wolters <>
Tested-by: Wouter Wolters <>

History

#1 Updated by Tymoteusz Motylewski over 4 years ago

Issue originally reported by Gerhard Rupp

#2 Updated by Tymoteusz Motylewski over 4 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.

#3 Updated by Gerhard Rupp over 4 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

#4 Updated by Gerhard Rupp over 4 years ago

I´m using TYPO3 6.2.13

#5 Updated by Manuel Link over 4 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

#6 Updated by Alexander Opitz over 4 years ago

  • Target version changed from 6.2.14 to 6.2.15

#7 Updated by Alexander Opitz over 4 years ago

@Manuel

Would you like to bring your patch into gerrit for master?

#8 Updated by Tymoteusz Motylewski over 4 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.

#9 Updated by Manuel Link over 4 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.

#10 Updated by Gerrit Code Review over 4 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

#11 Updated by Gerrit Code Review over 4 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

#12 Updated by Gerrit Code Review over 4 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

#13 Updated by Gerrit Code Review over 4 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

#14 Updated by Gerrit Code Review over 4 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

#15 Updated by Gerrit Code Review over 4 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

#16 Updated by Gerrit Code Review over 4 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

#17 Updated by Gerrit Code Review over 4 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

#18 Updated by Gerrit Code Review over 4 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

#19 Updated by Gerrit Code Review about 4 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

#20 Updated by Anonymous about 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#21 Updated by Gerrit Code Review about 4 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

#22 Updated by Anonymous about 4 years ago

  • Status changed from Under Review to Resolved

#23 Updated by Riccardo De Contardi about 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF