| Summary: | Duplicate search result | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Tools] PTP | Reporter: | John Liu <john_ws_liu> | ||||
| Component: | RDT | Assignee: | Vivian Kong <vivkong> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | vivkong | ||||
| Version: | unspecified | ||||||
| Target Milestone: | 4.0.6 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| See Also: | https://bugs.eclipse.org/bugs/show_bug.cgi?id=325385 | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
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. Created attachment 188056 [details]
patch to 40* stream
I'll take a look Applied to ptp_4_0 and HEAD. Thanks John. |
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