rfind-1.0: search-on-typing for all your files

M

Martin Ankerl

Hi all,

I have created a little application that indexes a given directory,
and then allows to quickly search this index with regular expressions.
The motivation behind this app was that someone thought this had to be
in C++ to be fast, so I proved him wrong: search-on-typing with more
than 500,000 indexed files is easily possible :)

I have tried to make this actually useful, so it is possible to define
rules when clicking on a file. An example is included

* Hierarchical presented search results
* Search-on-typing
* Define rules to execute on a click

Have a look, and tell me what you think!

Get it here:
http://martin-ankerl.at.tf/rfind-1.0.zip
It is public domain, do whatever you want with it, but don't sue me.

Martin Ankerl
 
A

Alexey Verkhovsky

class String
def levenstein(other, ins=2, del=2, sub=1)
# ins, del, sub are weighted costs
return nil if self.nil?
return nil if other.nil?
... proceed to calculate Levenstein distance between self and other
end
end

I don't understand, what is this line for:

return nil if self.nil?

Can self.nil? ever evaluate to true in a method of String???

Best regards,
Alexey Verkhovsky
 
F

Florian Gross

Martin said:
Hi all,
Moin!

Have a look, and tell me what you think!

It looks nice, but you should state that it searches in file names and
not file contents somewhere. :)

I think that you could further simplify the code by using Find.find().
It's part of the Standard Ruby and can be used to recursively iterate
over directories / files. (It is defined in 'find.rb')

Regards,
Florian Gross
 
F

Florian Gross

Alexey said:
I don't understand, what is this line for:
return nil if self.nil?
Can self.nil? ever evaluate to true in a method of String???

It looks like a bug -- the only Object that returns true on .nil? in
Standard Ruby is nil itself. Maybe they wanted to do self.empty? /
other.empty? instead? (But then again the Levenstein distance from an
empty string to "foo" should be 3...)
Best regards,
Alexey Verkhovsky

More regards,
Florian Gross
 
M

Michael Fivis

--- Florian beat me to it. :)

It looks nice, but you should state that it searches in file names and
not file contents somewhere. :)

I think that you could further simplify the code by using Find.find().
It's part of the Standard Ruby and can be used to recursively iterate
over directories / files. (It is defined in 'find.rb')

Regards,
Florian Gross
 
M

Martin Ankerl

I think that you could further simplify the code by using Find.find().

I already use Find.find, it's somewhere in src/hierarchy.rb. But I
need to have a special data structure, so I have a wrapper for this.

Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,444
Messages
2,571,709
Members
48,796
Latest member
Greg L.
Top