The simpletest's written by Steven for the search module (see #205631) uncovered a bug in the search results normalization where the wrong value was being used to normalize the results. This patch fixes that.

CommentFileSizeAuthor
205631.patch1018 bytesdouggreen

Comments

chx’s picture

Status: Needs review » Reviewed & tested by the community

I won't pretend that I understand any of these but as it causes 13 more tests to pass it surely is good.

gábor hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Looks logical. Committed.

scroogie’s picture

Perhaps the comment above the normalization query should be adjusted, because it currently says

// Calculate maximum keyword relevance, to normalize it.

although after this patch it effectively calculates the sum of all keyword relevances and normalizes with that value instead of the highest relevance, meaning that the highest relevance is now not always 1.0.

douggreen’s picture

Yes, it calculates uses the SQL SUM() function here when calculating the normalization scale , but it also uses the SQL SUM() function on line 1285 to calculate the actual value. So, I think that the highest relevance is still always 1.0.

The new serach simple tests (see #205631) make sure that the returned relevancies are always in the range 0 to 1, and the patched code now passes all of those tests. Do you have a test case that shows differently?

scroogie’s picture

I didn't mean it's flawed. Originally I just wanted to point out that the comment needs updating. You are right, the highest relevance will still be 1.0, I just missed the ORDER BY clause first.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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