diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/search/search.extender.inc | 9 | ||||
-rw-r--r-- | modules/simpletest/tests/entity_query.test | 12 |
2 files changed, 8 insertions, 13 deletions
diff --git a/modules/search/search.extender.inc b/modules/search/search.extender.inc index 6c0c7600b..1eae2caa6 100644 --- a/modules/search/search.extender.inc +++ b/modules/search/search.extender.inc @@ -415,6 +415,10 @@ class SearchQuery extends SelectQueryExtender { // Add default score. $this->addScore('i.relevance'); } + if (count($this->getOrderBy()) == 0) { + // Add default order. + $this->orderBy('calculated_score', 'DESC'); + } if (count($this->multiply)) { // Add the total multiplicator as many times as requested to maintain @@ -432,11 +436,6 @@ class SearchQuery extends SelectQueryExtender { // Convert scores to an expression. $this->addExpression('SUM(' . implode(' + ', $this->scores) . ')', 'calculated_score', $this->scoresArguments); - if (count($this->getOrderBy()) == 0) { - // Add default order after adding the expression. - $this->orderBy('calculated_score', 'DESC'); - } - // Add tag and useful metadata. $this ->addTag('search_' . $this->type) diff --git a/modules/simpletest/tests/entity_query.test b/modules/simpletest/tests/entity_query.test index e120c53b2..0b3db8b59 100644 --- a/modules/simpletest/tests/entity_query.test +++ b/modules/simpletest/tests/entity_query.test @@ -501,20 +501,16 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase { $query = new EntityFieldQuery(); $query ->entityCondition('entity_type', 'test_entity_bundle_key') - ->propertyCondition('fttype', 'und', 'CONTAINS'); + ->propertyCondition('ftid', 1, 'CONTAINS'); $this->assertEntityFieldQuery($query, array( array('test_entity_bundle_key', 1), - array('test_entity_bundle_key', 2), - array('test_entity_bundle_key', 3), - array('test_entity_bundle_key', 4), - array('test_entity_bundle_key', 5), - array('test_entity_bundle_key', 6), ), t('Test the "contains" operation on a property.')); $query = new EntityFieldQuery(); - $query->fieldCondition($this->fields[1], 'shape', 'uar', 'CONTAINS'); + $query->fieldCondition($this->fields[0], 'value', 3, 'CONTAINS'); $this->assertEntityFieldQuery($query, array( - array('test_entity_bundle', 5), + array('test_entity_bundle_key', 3), + array('test_entity', 3), ), t('Test the "contains" operation on a field.')); $query = new EntityFieldQuery(); |