Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 335958 - Duplicate search result
Summary: Duplicate search result
Status: RESOLVED FIXED
Alias: None
Product: PTP
Classification: Tools
Component: RDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 4.0.6   Edit
Assignee: Vivian Kong CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-01 09:19 EST by John Liu CLA
Modified: 2011-02-01 13:50 EST (History)
1 user (show)

See Also:


Attachments
patch to 40* stream (4.25 KB, text/plain)
2011-02-01 10:43 EST, John Liu CLA
vivkong: iplog+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John Liu CLA 2011-02-01 09:19:53 EST
Build Identifier: 

If we search student in the following Source code, there will be duplicate search results pointing to "Student <int>".

template <class type> class Student: public Five{
private:


public:
	type ID;
};

class Teacher: public Student <int>{

};

Reproducible: Always
Comment 1 John Liu CLA 2011-02-01 09:36:11 EST
The reason of this problem is stated in the cdt bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=325385.

However, I can't port the cdt fix to rdt directly, since the search classes are very different from cdt.

The fix in rdt will be in RemoteSearchQueryAdapter class by adding a sort MatchesComparator to sort the matches list before adding it to result. The sort order is by file uri first, then offset, then length, make sure a match with a longer length is placed before a match with a shorter length if their file uri and offset are the same.

Then fix in RemoteSearchMatchAdapter updates the equals function, if a match has a same indexfile, a same offset but a shorter length, we will consider it equals to the target match. 

In this way, we can eliminate the duplicate matches with same offset and keep the one which covers longer segment.
Comment 2 John Liu CLA 2011-02-01 10:43:44 EST
Created attachment 188056 [details]
patch to 40* stream
Comment 3 Vivian Kong CLA 2011-02-01 12:56:56 EST
I'll take a look
Comment 4 Vivian Kong CLA 2011-02-01 13:50:19 EST
Applied to ptp_4_0 and HEAD.  Thanks John.