$normalize = db_result(db_query_range($select, $arguments, 0, 1)); the field name is irrevelant and it's not clear whether ORDER BY score is the DB column or the aliased columns. Yes works in MySQL and pgsql but not in sqlite and then if it does not matter for my/pg why not fix it?

CommentFileSizeAuthor
#8 score_result.patch2.93 KBchx
#6 score_result.patch3.52 KBchx
search_query_fix.patch802 byteschx

Comments

mlncn’s picture

Status: Needs review » Reviewed & tested by the community

Tested on MySQL, Drupal 7. Everything continues to work as before.

drewish’s picture

sounds like a simple enough fix. verified that the search tests pass on mysql 5.1.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the reviews all. :)

Committed to HEAD. Thanks!

damien tournoud’s picture

Hum.

In the "get the total score to normalize it" query, the "ORDER BY score" has no purpose at all, we might as well drop it.

The true issue is below, in the query:

$result = pager_query("$select $sort_parameters", 10, 0, $count_select, $arguments);

$select is made in part from $column2 that default to "i.relevance AS score" and from $sort_parameters that default to "ORDER BY score DESC".

damien tournoud’s picture

Status: Fixed » Active
chx’s picture

Status: Active » Needs review
StatusFileSize
new3.52 KB

This patch changes every score result to score_result and all tests pass.

webchick’s picture

Status: Needs review » Needs work

calculated_score seems a better alias than score_result, which is rather ambiguous. According to #drupal, DamZ agrees. :)

chx’s picture

Status: Needs work » Needs review
StatusFileSize
new2.93 KB

We could call it dancing_blue_elepehants for all I care.

webchick’s picture

Status: Needs review » Fixed

Thanks, committed! :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.