Al Boldi wrote: > Michael Van Canneyt wrote: > > On Sun, 4 Jun 2006, Mattias Gaertner wrote: > > > Al Boldi <[EMAIL PROTECTED]> wrote: > > > > Mattias Gaertner wrote: > > > > > Al Boldi wrote: > > > > > > The SourceEditor currently has the ability to search in files by > > > > > > searching a complete directory hierarchy. This may result in > > > > > > prolonged searches if the hierarchy is large. > > > > > > > > > > > > By pre-Indexing the sources, this could be reduced dramatically. > > > > > > > > > > > > Would this be difficult to implement? > > > > > > > > > > Can you give an example how this pre-Indexing should work? > > > > > > > > On the search in files dialog, there could be a button to create a > > > > word index of the sources, and a checkbox to use this index instead > > > > of grepping the files each time. > > > > > > Implementing should be simple. But making it fast, can be a lot more > > > work. If you want to implement it and have any questions, don't > > > hesitate to ask. > > > > I suggest that if this is implemented, it should be done as an external > > program, so it can be run in the background, or immediatly after > > installation. > > Sure. Do you know of any external mini-crossindexing engine? Jedi?
I finally found one, and the reason it took me so long is because it was hiding behind some obscure name just like lazarus; it's called: swish-e It's lightening fast, especially during retrieve, but what's important is that it outputs a list of filenames ready to be loaded into the TheFileList object for DoFindInFiles to do the rest. Like this: ============================ {Search All the files in a project and add the results to the SearchResultsView Dialog} procedure TSourceNoteBook.FIFSearchIndex(ADialog: TLazFindInFilesDialog); var TheFileList: TStringList; SearchForm: TSearchForm; begin try TheFileList:= TStringList.Create; SearchForm:= FIFCreateSearchForm(ADialog); ExecuteProcess('/bin/sh' ,'-c "/idx ' +SearchForm.SearchDirectory+' ' +SearchForm.SearchText +' | grep ' +SearchForm.SearchMask +' > /tmp/idx.dmp"'); TheFileList.LoadFromFile('/tmp/idx.dmp'); SearchForm.SearchFileList:= TheFileList; DoFindInFiles(SearchForm); finally FreeAndNil(TheFileList); FreeAndNil(SearchForm); end; end; ============================ There are two things to notice: 1. This is not swish-e dependent, here "/idx" is a shell script, which means any indexing engine that can output a list of files can interface with DoFindInFiles. 2. This is specific to the unix platform; how can we make it platform independent. Thanks! -- Al _________________________________________________________________ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives