Bug 192767 - It would be great if you could do a file search on any file system directory (non-workspace)
Summary: It would be great if you could do a file search on any file system directory ...
Status: ASSIGNED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Search (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 enhancement with 9 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform-Search-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
: 359320 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-06-14 18:30 EDT by Warren Paul CLA
Modified: 2014-03-21 04:29 EDT (History)
18 users (show)

See Also:


Attachments
System search plugin (for searching outside the workspace) (708.19 KB, application/x-zip-compressed)
2008-06-27 14:13 EDT, Steve Sobek CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Warren Paul CLA 2007-06-14 18:30:37 EDT
I use file search all of the time and it's great.  But I find myself going back to my old IDE so I can search arbitrary file system directories.  That's pretty much the only thing I still use the old IDE for.

I know Eclipse is very focused on the workspace and IResource's, but I don't see why file search can't work on external files.  It looks like the actual searching is done using the ITextFileBuffer, which I believe you can get for any external file as well.

I'm not sure what it would look like, but probably just add another radio option under the scope group in the file search tab right under working set.  It would just need an edit box and browse button.

We ship an Eclipse based C++ IDE product and several of our customers have asked for this as well.  We could potentially do the work and contribute it, but thought I should start with a Bugzilla.
Comment 1 Martin Aeschlimann CLA 2007-06-15 03:48:16 EDT
If you're interested in investigating here, that would be great. But it will be quite tricky I think. As you say, everything is centered around resources.
Don't you want to use linked folders to point to the other interesting resources? You would get more than just search support, but could also see the structure in the explorer or navigator.

I would suggest to implement this as a new search, with it's own tab. Performance might be a problem. Text search isn't using an index, but does a raw search. Maybe a more attractive solution would be a to build a bridge to one of the many desktop search engines (Google).
Comment 2 Ken Ryall CLA 2007-09-07 16:28:47 EDT
Martin, We've been investigating the possibility of having this feature add linked folders for the external directories we want to search but we have two concerns:

These directories would then be searched by standard File search as well unless there is some way to tag them to be excluded. We're concerned people would find this confusing.

There could be a significant performance hit to having linked folders that contain lots of source files. What if the user refreshes everything in the workspace?

Those concerns have led us to think we will need to do a custom search and search results view just as RSE has done for its Remote Search.
Comment 3 Martin Aeschlimann CLA 2007-09-10 04:46:34 EDT
I also think a separate search would be better. Thanks for the comment.
Comment 4 Juergen Weber CLA 2007-11-05 04:57:23 EST
I'd prefer a file system (directory) option in the usual Search dialog.

Search -> (File|Java|Plugin) Search

---Scope ---
....
() Directory [               ] Choose



Comment 5 Rachel Majchrzak CLA 2008-03-20 06:56:26 EDT
I find this functionnality really important for me too. At the moment, I'm still using Kdevelop for this. Note that, there, it works really well without any performance issue...
Comment 6 Steve Sobek CLA 2008-06-27 14:11:31 EDT
I'm attaching the code for the com.nokia.search.system plugin. It adds a tab to the Search dialog that lets you search files starting in any folder.

You specify the search string and file name patterns the same way as with the File Search tab. You can type or browse to the root search folder, and you can specify whether to search subfolders or hidden files.

Because of the depth of file system directory structures, we decided to only present a table layout in the System Search results view. I.e., there is no "Show as Tree" layout. The table columns are Name, Type (which is just the extension for now), Size, Date Modified, and Path. If a file has more than 1 match, the Name column notes that. E.g., "file_name (53 matches)".

The code was originally based on org.eclipse.search code for 3.2, but has now been integrated with 3.4. I'd say a lot more than 90% of the code is common to org.eclipse.search. All instances of org.eclipse.search have been renamed so the plugin can be added to any 3.4 Eclipse.

Since the 3.4 File Search feature of showing the content of matched lines is only in the "Show as Tree" layout, that code is not in com.nokia.search.system. It should be possible to add it and just not call it. Also, I have not changed the color of the number of matches, such as "(53 matches)", to cyan.
Comment 7 Steve Sobek CLA 2008-06-27 14:13:36 EDT
Created attachment 106032 [details]
System search plugin (for searching outside the workspace)
Comment 8 Chris Aniszczyk CLA 2008-07-01 10:29:34 EDT
Just forwarding Boris' comment to this bug as he has a point:

"Looks really useful, for any developer (not just C/C++). One question though: why did you create a new view instead of displaying the results in the existing Search view? Have you filed an enhancement request to make the Search view more flexible so that it can host your search results too?"
Comment 9 Martin Aeschlimann CLA 2008-07-01 11:01:16 EDT
Looks good!
As Chris said, it would be better to integrate in the search result view as well. Now new APIs are needed for that. I think with that number of duplicated lines of code will be quite small.
Comment 10 Boris Bokowski CLA 2008-07-01 11:12:52 EDT
(In reply to comment #9)
> well. Now new APIs are needed for that. I think with that number of duplicated

Did you mean "no new APIs are needed", or "but we need new APIs"?
Comment 11 Martin Aeschlimann CLA 2008-07-01 11:33:27 EDT
I meant _no_ new APIs are required. Since 3.0 you contribute your search result view for a search result class and the page will show up if a result is available.
Comment 12 astifter Mising name CLA 2009-03-30 13:40:18 EDT
I just discovered this plugin and I really like the idea since I was search for this functionality for quite some time. 

I would really like this to go into CDT or Eclipse Platform.
Comment 13 Dani Megert CLA 2009-04-02 10:04:44 EDT
Steve, would you be willing to contribute that feature and provide a patch against the Eclipse code base?
Comment 14 Steve Sobek CLA 2009-04-02 12:08:11 EDT
I can contribute it as a patch against the code base.

There are two changes that should be made to it before that:

1) As recommended, it should use the regular Search results view.

2) System search currently behaves like regular file search: first gather the list of matched files and second search inside each file. System search needs instead to search inside each file as the file name is matched. Regular file search has available the complete list of file names in the workspace, so matching is quick. However, system search can spend considerable time getting its file list before looking inside the first file for a string match.

Comment 15 Dani Megert CLA 2009-04-02 12:59:07 EDT
OK, great. Just FYI: there's no hurry as we're closing down on 3.5.
Comment 16 Dani Megert CLA 2011-10-03 06:52:42 EDT
*** Bug 359320 has been marked as a duplicate of this bug. ***
Comment 17 Dani Megert CLA 2011-10-03 06:55:40 EDT
(In reply to comment #16)
> *** Bug 359320 has been marked as a duplicate of this bug. ***

This bug links Mylyn Incubator bug 349351 which has an implementation of Desktop search.
Comment 18 Martin Oberhuber CLA 2013-03-05 15:21:06 EST
I just stumbled onto this contribution via that page:
http://mcuoneclipse.com/2012/04/06/5-best-eclipse-plugins-3-system-and-desktop-search/

This looks like a really interesting add-on, but I'm wondering what it's state is? - Most of the sources seem to be cloned from EPL sources so I assume that technically it must be EPL ... but it's still a significant contribution so I assume we'll need the "three questions" answered by the contributors:

1. Did you write the contribution yourself?
2. Did you reference any 3rd party material, and if yes was it under the EPL ?
3. Are you authorized by your employer to make the contribution?

Steve, Ken - if you're still listening could you answer those questions for us with a statement here on bugzilla like the one on the template here:
http://eclipse.org/tm/development/committer_howto.php#external_contrib

Thanks,
Martin
Comment 19 Martin Oberhuber CLA 2014-03-21 04:29:47 EDT
CQ:WIND00-WB4-3218