Details
-
Bug
-
Resolution: Fixed
-
High
-
5.3-dev, 5.4.0-beta1
-
None
Description
Detected while testing EZP-22930.
If you make a Criterion\Subtree search with an a node which value is a substring of another node, the results won't be displayed correctly.
This happens because Content/Search/Gateway/CriterionHandler/Subtree.php, line #54
$statements = array(); foreach ( $criterion->value as $pattern ) { $statements[] = $query->expr->like( $this->dbHandler->quoteColumn( 'path_string', $table ), $query->bindValue( $pattern . '%' ) ); }
Instead concatenation a "%" to $pattern, the code should confirm if $pattern ends with a "/" and, if not, append instead a "/%"
Steps to reproduce
- Create some folder. Take note of its location (I'll assume the nodeID is 120).
- Create four articles under the folder and name them: eZTest #001, eZTest #002, eZTest #003, eZTest #004
- Create a command that performs a search with a Criterion\Subtree
$filter = array( 'filter' => new Criterion\LogicalAnd( array( new Criterion\FullText( $text ), new Criterion\Subtree( $subtree ) ) ) ); $query = new Query( $filter );
- Execute the command using /1/2/12 value for $subtree
php ezpublish/console teste:mysearch "eZTest" /1/2/12
- Execute the command using /1/2/12/ value for $subtree
php ezpublish/console teste:mysearch "eZTest" /1/2/12/
Attachments
Issue Links
- discovered while testing
-
EZP-22930 Search: Remove duplicate criterions
- Closed