A simple example of indexing and searching.

Check that Lupy has been installed correctly by starting Python
and successfully doing:
    import lupy

You can exit python.

The simplest way to get started with Lupy is to use the indexer
wrapper. The files simple.py and indexemail.py use the wrapper.
index.py and search.py use Lupy directly. 

In this examples directory there is a directory named ./aesop/ which
contains 30 files, each with a fable in them.

For a simple example, using the wrapper:
    python simple.py

Basically you can do this:
    # To index
    from lupy.indexer import Index
    i = Index('myindex', create=True)
    # Our app needs fields named text and notes
    i.index(text='some text', notes='some notes', _uid='123')
    i.index(text='some other text', notes='some more notes', _uid='345')
    i.close()

    # To search
    from lupy.indexer import Index
    i = Index('myindex', create=False)
    # find in all fields
    i.find('some')
    # find in one field
    i.findInField(text='some')
    i.delete(uid=123)
    i.close()

    Once you create an Index instance, you can keep
    it around and call index and find against it.
    You don't have to create a new one just to search.
    Remember to call close() to commit your changes
    to disk. 
    

For a simple example of indexing email using the wrapper:
    python indexemail.py myDirOfMsgs
    where myDirOfMsgs is a directory of messages (mdir)
    
For direct Lupy try index.py and search.py:
    python index.py

You will see some confirmation that Lupy is adding the text files to
an index. The index will be saved in a directory named './aesopind/'.

Once indexing is finished, have a look in ./aesopind/ and you will
see a lot of files with names like _19.tii. Each of these files belongs
to a segment. This is what Lucene format indexes look like. The number
of files in this directory depends on a lot of factors. Calling optimize()
once in a while compacts all the segments into one.

Back in the examples directory type:
    python search.py

This will perform a few different searches against the index that you
just built and print the results.



