This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 253389 - Change Go To Dialogs comparator to Levenshtein distance
Summary: Change Go To Dialogs comparator to Levenshtein distance
Status: RESOLVED FIXED
Alias: None
Product: utilities
Classification: Unclassified
Component: Jump To (show other bugs)
Version: 8.1
Hardware: All All
: P3 normal with 2 votes (vote)
Assignee: Tomas Zezula
URL:
Keywords:
: 254910 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-07-09 16:52 UTC by Vladimir Voskresensky
Modified: 2017-05-17 09:31 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
incorrect choice in Go To File dialog (43.28 KB, image/png)
2015-07-09 16:53 UTC, Vladimir Voskresensky
Details
picture (98.11 KB, image/png)
2015-07-10 07:15 UTC, Tomas Zezula
Details
patch for GTS (10.40 KB, patch)
2015-07-10 07:33 UTC, Tomas Zezula
Details | Diff
Options Panel (121.19 KB, image/png)
2017-05-17 08:32 UTC, Tomas Zezula
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Voskresensky 2015-07-09 16:52:46 UTC
Let's say I have 3 files in my project:
AArch64TargetInfo.java
AArch64beTargetInfo.java
AArch64leTargetInfo.java

When I put in clipboard the full file name AArch64TargetInfo.java and press Go To File then instead of fully matched AArch64TargetInfo.java I see the selection of AArch64beTargetInfo.java.

I'd expect "full match" to have priority over partially matched choices

This problem is especially confusing when I use File:Line notation
See attachement
Comment 1 Vladimir Voskresensky 2015-07-09 16:53:22 UTC
Created attachment 154545 [details]
incorrect choice in Go To File dialog
Comment 2 Tomas Zezula 2015-07-10 07:14:25 UTC
All the:

AArch64TargetInfo.java
AArch64beTargetInfo.java
AArch64leTargetInfo.java

match camel case insensitive query: a*arch*64*target*info*.java*

The ordering is done by org.netbeans.modules.jumpto.EntityComparator written by CND team (vvg@netbeans.org). I've always preferred different one (ordering by levenshtein distance) but alphabet won.

I still have prototype of LS ordering for GoToSymbol, see attached schreenshot. However this will remove the alphabetical ordering.
Comment 3 Tomas Zezula 2015-07-10 07:15:00 UTC
Created attachment 154552 [details]
picture
Comment 4 Tomas Zezula 2015-07-10 07:33:51 UTC
Created attachment 154553 [details]
patch for GTS
Comment 5 Tomas Zezula 2015-09-08 15:22:58 UTC
*** Bug 254910 has been marked as a duplicate of this bug. ***
Comment 6 markiewb 2015-09-08 19:05:42 UTC
@Tomas: How about this? Keep the alphabetic ordering, but select the best matching entry (f.e. by LS distance)

F.e. in https://netbeans.org/bugzilla/attachment.cgi?id=154545 the third row has the selection focus
Comment 7 Tomas Zezula 2017-05-17 08:30:57 UTC
Fixed jet-main: http://hg.netbeans.org/jet-main/rev/8f3a3358b27f
Added a possibility to change the ordering to similarity, the default is alphabetical sort due to compatibility but can be changed in the:
Tools/Options/Editor/Go To.
Comment 8 Tomas Zezula 2017-05-17 08:32:14 UTC
Created attachment 164334 [details]
Options Panel
Comment 9 Christian Lenz 2017-05-17 08:46:30 UTC
So now it is as markiewb said? The 3rd row will be on top of it and will be selected, because this is the right/first match for AArch64TargetInfo.java?
Comment 10 Tomas Zezula 2017-05-17 09:19:46 UTC
No, if you switch the option, the ordering of items is changed to Levenshtein distance.
Comment 11 Christian Lenz 2017-05-17 09:31:48 UTC
Thx, I got it.