[pylucene-dev] Re. Best ways to avoid stomping on existing indexes?

Andi Vajda vajda at osafoundation.org
Fri Feb 11 11:06:52 PST 2005


> Here's a small piece of code that nine times out of ten quits with a
> Microsoft Runtime error box rather than an exception:

I was not able to reproduce this. I always get an 
ArrayIndexOutOfBoundsException. I tried it on Win2k and Mac OS X.

DId you build your own PyLucene for Windows or are you using the binaries 
released ? If you built your own, what version of the mingw compiler did you 
use ?

Andi..

>
> -- 8< -- 8< --
>
> import os, shutil
> from PyLucene import *
>
> INDEX_DIR = "__TEST__"
>
> # Remove any index left over from a previous test.
> if os.path.exists(INDEX_DIR):
>    shutil.rmtree(INDEX_DIR)
>
> # Create an empty index.
> store = FSDirectory.getDirectory(INDEX_DIR, True)
> writer = IndexWriter(store, WhitespaceAnalyzer(), True)
> writer.close()
>
> # Try to delete a non-existent document.
> reader = IndexReader.open(store)
> reader.deleteDocument(0)
>
> I'm running Python 2.4 on Windows XP with the binary build of PyLucene
> 0.9.7.
>
> -- 8< -- 8< --
>
> I'm seeing this kind of thing a lot as I'm developing my app - always when
> I've made a mistake, like trying to delete a non-existent document, but
> almost every time I make such a mistake I get a hard crash rather than an
> exception.
>
> -- 
> Richie Hindle
> richie at entrian.com
>
> _______________________________________________
> pylucene-dev mailing list
> pylucene-dev at osafoundation.org
> http://lists.osafoundation.org/mailman/listinfo/pylucene-dev
>


More information about the pylucene-dev mailing list