Eric,
Please send the exception stack trace with line numbers, it would help
a great deal.
Otis
--- Eric Fixler <[EMAIL PROTECTED]> wrote:
> Hello. I'm pretty new to Lucene. I've had good luck so far, but o
> bug
> just cropped up in the code I use to make indexes. I'm using rc4 and
>
> (sorry) did not change the code; I just noticed my indexes failing...
>
> anyway, here's the relevant segment...I know that the file path is
> valid, and files _are_ getting created updated there -- I checked the
>
> timestamps.
>
> Also, I'm confused about the create boolean in the IndexWriter
> constructor -- should it be true for false when updating existing
> entries in an
> existing index.
>
> public void makeIndex() throws IOException, NestedException {
> this.logDebug("Creating index in " + this.getIndexFileName());
> IndexWriter writer = new
> IndexWriter(this.getIndexFileName(),new StandardAnalyzer(), false);
> //I
> was using 'true' changed to false
> //for debugging, to no effect
> // <cut>full text below, for those interested</cut>
>
> try {
> for (int i=0; i < projects.length; i++) {
> this.logDebug("Adding project " +
> projects[i].getId() + " [" + projects[i].getDisplayName() + "] to
> index");
> Document d = this.makeProjectDocument(projects[i]);
> writer.addDocument(d);
> this.logDebug("Done adding project " +
> projects[i].getId() + " to index.");
>
> }
> this.logDebug("Done processing vsp information for lucene
> search index, about to finalize index.");
> } catch (RuntimeException re) {
> this.logError("Unexpected error writing index!", re);
> throw(re);
> } finally {
> writer.optimize();
> this.logDebug("index optimized...closing");
> writer.close(); //*** THIS IS WHERE THE EXCEPTION GETS THROWN
> this.logDebug("Index closed; done writing lucene index.");
> }
> }
>
>
> I looked at the the IndexWriter.close() method, and it seems like
> ramDirectory, directory or writeLock need to be null o make this
> happen.
>
> Anyway, any advice would be greatly appreciated.
>
> best
> eric
>
>
> -- full method listing
> public void makeIndex() throws IOException, NestedException {
> this.logDebug("Creating index in " + this.getIndexFileName());
> IndexWriter writer = new
> IndexWriter(this.getIndexFileName(),new StandardAnalyzer(), false);
> //get projects/activities, make docs for each...
> Project[] projects = null;
> try {
> projects = this.getProjectService().getProjectsById(null);
> } catch (Exception e) {
> String msg = "Can't get projects for indexing, aborting";
> this.logError(msg,e);
> throw new NestedException(msg,e);
> } finally {
> writer.close();
> }
>
> try {
> for (int i=0; i < projects.length; i++) {
> //Project project = projects[i];
> this.logDebug("Adding project " +
> projects[i].getId() + " [" + projects[i].getDisplayName() + "] to
> index");
> Document d = this.makeProjectDocument(projects[i]);
> writer.addDocument(d);
> this.logDebug("Done adding project " +
> projects[i].getId() + " to index.");
>
> }
> this.logDebug("Done processing vsp information for lucene
> search index, about to finalize index.");
> } catch (RuntimeException re) {
> this.logError("Unexpected error writing index!", re);
> throw(re);
> } finally {
> writer.optimize();
> this.logDebug("index optimized...closing");
> writer.close();
> this.logDebug("Index closed; done writing lucene index.");
> }
> }
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
__________________________________________________
Do You Yahoo!?
Yahoo! Greetings - Send FREE e-cards for every occasion!
http://greetings.yahoo.com
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>