# Indexing the local file system

**URL:** <https://www.ruby-forum.com/t/indexing-the-local-file-system/163385>\
**Category:** Ferret\
**Created:** [March 19, 2009, 7:23pm UTC](https://www.ruby-forum.com/t/indexing-the-local-file-system/163385 "2009-03-19T19:23:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![HuangS\_ZijianSVicto](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/a3d4f5/32.png) [@HuangS\_ZijianSVicto](https://www.ruby-forum.com/u/HuangS_ZijianSVicto)\
**Post date:** [March 19, 2009, 7:23pm UTC](https://www.ruby-forum.com/t/indexing-the-local-file-system/163385/1 "2009-03-19T19:23:15Z")

</div>

Hi, all:  
I am new to Ferret, can anyone please tell me what do I do to index  
some text files in a local directory?

Thanks

Victor

---

<div class="post-metadata">

**Author:** ![HuangS\_ZijianSVicto](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/a3d4f5/32.png) [@HuangS\_ZijianSVicto](https://www.ruby-forum.com/u/HuangS_ZijianSVicto)\
**Post date:** [March 19, 2009, 8:22pm UTC](https://www.ruby-forum.com/t/indexing-the-local-file-system/163385/2 "2009-03-19T20:22:00Z")

</div>

On Thu, 19 Mar 2009, Huang, Zijian(Victor) wrote:

> Hi, all:  
> I am new to Ferret, can anyone please tell me what do I do to index  
> some text files in a local directory?

I got started with the book (not to hand) and modifying some code, which  
I then put here:  
[http://www.cse.dmu.ac.uk/~hgs/ruby/#ff.rb](http://www.cse.dmu.ac.uk/~hgs/ruby/#ff.rb)

Hopefully that will do most of what you want.

> Thanks
> 
> Victor

```
    Hugh

```

---

<div class="post-metadata">

**Author:** ![HuangS\_ZijianSVicto](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/a3d4f5/32.png) [@HuangS\_ZijianSVicto](https://www.ruby-forum.com/u/HuangS_ZijianSVicto)\
**Post date:** [March 19, 2009, 8:30pm UTC](https://www.ruby-forum.com/t/indexing-the-local-file-system/163385/3 "2009-03-19T20:30:48Z")

</div>

Hi!

On 19.03.2009, at 19:12, Huang, Zijian(Victor) wrote:

> Hi, all:  
> I am new to Ferret, can anyone please tell me what do I do to  
> index some text files in a local directory?

Have a look at either RDig ([rdig.rubyforge.org](http://rdig.rubyforge.org)) or the FerretFinder  
project ([http://www.methods.co.nz/ff/](http://www.methods.co.nz/ff/)) - each of these projects do  
what you want (and are open source).

Or, even better, get the Ferret Book (available as PDF or in Print  
from O’Reilly) for a complete reference including many examples (afair  
there’s also an example that deals with indexing files).

Basically it boils down to

- create new ferret index
- for each file:
  - get textual content (involves conversion from pdf, word or  
whatever file format to plain text)
  - create ferret document with textual content and filename
  - add ferret document to ferret index

- close ferret index

Cheers,  
Jens

–  
Jens KrÃ¤mer  
Finkenlust 14, 06449 Aschersleben, Germany  
VAT Id DE251962952  
[http://www.jkraemer.net/](http://www.jkraemer.net/) - Blog  
[http://www.omdb.org/](http://www.omdb.org/) - The new free film database

---

<div class="post-metadata">

**Author:** ![HuangS\_ZijianSVicto](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/a3d4f5/32.png) [@HuangS\_ZijianSVicto](https://www.ruby-forum.com/u/HuangS_ZijianSVicto)\
**Post date:** [March 19, 2009, 10:43pm UTC](https://www.ruby-forum.com/t/indexing-the-local-file-system/163385/4 "2009-03-19T22:43:28Z")

</div>

Great!  
Thanks for the helps

Vic
