»   »   »

How to Index a Bunch of Files

I needed to search trough a very large number of source files for a list of terms.

There are many ways to do this, but I chose to use swish-e as I could also use Perl with it at a later time.

First, download swish-e from here

Then, once installed, or built as per their instructions.

  • Setup a config file like so:

    cat > swish-e.conf
    # swish-e.conf
    IndexDir SOURCE
    IndexOnly .java .xml .sql
    IndexFile swish-index
        

    Next, create the index:

    swish-e -c swish-e.conf
        

    Finally, run your search (remove the "-m 3" if you want more than 3 results):

    swish-e -f swish-index -m 3 -w MySearch
        

    Reference

  • I found this useful.

  • © Roqet :: 2022-03-01 16:07:35