lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "amigo@max3d.com" <am...@max3d.com>
Subject Re: Problem with indexing/merging indices - documents not indexed.
Date Mon, 06 Dec 2004 23:28:40 GMT
Hi Chris

actually for merging indices that's how Otis did it in the article I quoted:

            // if -r argument was specified, use RAMDirectory
            RAMDirectory ramDir    = new RAMDirectory();
            IndexWriter  ramWriter = new IndexWriter(ramDir, analyzer, 
true);
            addDocs(ramWriter, docsInIndex);
            IndexWriter fsWriter   = new IndexWriter(indexDir, analyzer, 
true);
            fsWriter.addIndexes(new Directory[] { ramDir });
            ramWriter.close();
            fsWriter.close();

..which works great, and all I've done is replace the addDocs with my 
MySQL version of the function.

I do know about having to close and re-open to find the document count, 
which I've also tried but it didnt yield any difference,
a simple look in the index directory shows no files there except 
segements, even though it should've merged the RAMDir index into the fsDir.


thanks

-pedja



Chris Hostetter said the following on 12/6/2004 6:09 PM:

>: I would appreciate any feedback on my code and whether I'm doing
>: something in a wrong way, because I'm at a total loss right now
>: as to why documents are not being indexed at all.
>
>I didn't try running your code (because i don't have a DB to test it with)
>but a quick read gives me a good guess as to your problem:
>
>I believe you to call...
>	ramWriter.close();
>...before you call...
>	fsWriter.addIndexes(new Directory[] { ramDir });
>
>(I've never played with merging indexes, so i could be completley wrong)
>
>Everything I've ever read/seen/tried has indicated that untill you "close"
>your IndexWritter, nothing you do will be visible to anybody else who
>opens that "Directory"
>
>I'm also guessing that when you were trying to add the docs to fsWriter
>directly, you were using an IndexReader you had opened prior to calling
>fsWriter.close() to check the number of docs ... that won't work for hte
>same reason.
>
>
>
>
>-Hoss
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>
>
>
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message