Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 311148

Summary: SearchPageDescriptor#computeScore(Object) should test alternatives
Product: [Eclipse Project] Platform Reporter: Markus Keller <markus.kell.r>
Component: SearchAssignee: Platform-Search-Inbox <platform-search-inbox>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, paulslau
Version: 3.6   
Target Milestone: 3.6 RC1   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Fix testing both daniel_megert: review+

Description Markus Keller CLA 2010-04-30 05:37:00 EDT
Created attachment 166598 [details]
Fix testing both

Follow-up to bug 292924 (and bug 299151 and bug 310687)

In 3.5, the score for file extensions always won. Now, an ISearchPageScoreComputer is always tested first, but even if it returns UNKNOWN, the whole computeScore(..) method returns UNKNOWN, without further testing whether there is a score for file extensions.

We should at least fall back to the file extension if the ISearchPageScoreComputer returned UNKNOWN.

I would even do both tests and return the higher of the scores. The patch implements this strategy.
Comment 1 Dani Megert CLA 2010-04-30 08:13:04 EDT
Makes sense.
Comment 2 Dani Megert CLA 2010-05-01 03:33:43 EDT
The extension point doc says:

Note: This only applies if there is no org.eclipse.search.ui.ISearchPageScoreComputer adapter for the selected element.

Hence we should not try both but fall back in case of unknown and mention this case in the extension point doc.

Markus, do you agree?
Comment 3 Markus Keller CLA 2010-05-01 10:54:05 EDT
(In reply to comment #2)
That note has only been added during 3.6 (with bug 292924). Before, the ISearchPageScoreComputer was not even mentioned, and clients could assume that the "extensions" list was the only weight that was used.

I think trying both mechanism offers the maximum flexibility and does not cause more problems than always letting the ISearchPageScoreComputer win if it has a score.
Comment 4 Dani Megert CLA 2010-05-02 01:35:01 EDT
Oh, yes, you are right. The note was added in 3.6. Then I agree. I take your patch plus adjust the extension point doc.

I guess it's now time for you to get commit rights here ;-)
Comment 5 Dani Megert CLA 2010-05-02 01:56:08 EDT
Fixed in HEAD with attached patch plus updated doc.
Available in build > N20100501-2000.
Comment 6 Dani Megert CLA 2010-05-17 08:25:55 EDT
Verified in N20100516-2000.