Code search : just give one result per occurrence + occurrence count (instead of line numbers)

Related products: Software Factory

Code search returns each occurrence of the search term as a result, showing 23 results for two templates that only differ in the line numbers. Clicking one of the results does often show the template, but does not jump to the line number that is mentioned.

Often I only need to know the templates (or other objects) that contain the search term; as ‘code search’ does not allow editing or generating code without opening it in an editor, I have to open the underlying object anyway.

For me it would be handy to have a single line per object result, and instead of a line number, a count of the number of occurrences.

I imagine the change would be minimal, only involving a group by and a count.

Hi @Boudewijn@Maurice Liebregt@Marc Ferket,

Since you voted on this idea, I would at least like to have your opinion. But anyone else's opinion is also welcome.

Would something like this make the code search easier to use?

The results would get an extra layer containing the object, which is being used to group on. I kept the line numbers intact. so you can easily see which lines contain a hit.

If you get any false positives, or you are just not interested in some of the results, you can collapse the object, which instantly hides all line numbers.

Would love to hear your feedback on this.

OpenNeeds feedback

@Jeroen van den Belt I like your proposal, since I do use the line numbers, even when I’m opening the code in another editor like SSMS. Which coincidentally also supports line numbers.

This would give the best of both worlds!

Needs feedbackOpen

OpenWorking on it!

​When performing a code search, if there were multiple matches for an object, the object would be redundantly displayed alongside each line number.

2024.2 situation

In the 2024.3, the code search results will be presented in a hierarchical tree, showing the object once with all associated lines nested underneath. This makes it easier to manage your search results by collapsing items you're not interested in, which enhances overall clarity.

Additionally, we introduced a new task 'Hide search result'. This will allow you to hide specific items from the code search results that are not of interest to you. This is not only possible for individual lines, but also for objects, or even entire groups (which is one of the benefits of using a hierarchical tree, instead of the grouped grid as I suggested in an earlier comment).

When disabling the new prefilter 'Hide hidden search results' you can view the hidden results, and even include them again in the search results by using the task 'Show search result'. As long as they are hidden, they will be displayed in italics.

Note: When executing a new code search, previously hidden items that match the search string will be shown again.

Working on it!Next release