Details
-
Bug
-
Resolution: Unresolved
-
High
-
5.0, 5.1, 5.2-alpha1
Description
Though it is not marked as required, Criterion a a part of Query object not being handled as optional, which makes some things awkward and inefficient.
For example to fetch a list of 10 last published Content now we have to use something like:
new Query( array( 'criterion' => new Criterion\LogicalNot( new Criterion\ContentId( array( 0 ) ) ), 'offset' => 0, 'limit' => 10, 'sortClauses' => array( new SortClause\DatePublished(), ) ) )
While it would be more efficient and natural to just have:
new Query( array( 'criterion' => null,// or omit this line altogether 'offset' => 0, 'limit' => 10, 'sortClauses' => array( new SortClause\DatePublished(), ) ) )
Both Legacy and Solr storage gateways need to be updated to handle this change.
We should also document in API Query class that $criterion property is optional and what it means if it is not provided.
Also, SPI SearchHandler::findContent() should document for implementers that null as criterion needs to be handled.