FAQ
Hi,
I am dumping the database tables into lucene documents.
I am doing like this:

1. Get the rowset from database to be stored as Lucene Document.
2. Open IndexReader and check if they are already indexed.
If Indexed, delete them and add the new rowset.
Continue this till the end
3. Close IndexReader
4. Open IndexWriter
5. Write the same rowset in the index.
6. delete the rowset from database..
7. Repeat the same process[step 1 - step 7 ] till there are records in
database.


Like this i am doing Indexing and deletion.
Some key points:
1. New indexWriter is opened when there is not instance of indexwriter
available,but if available it makes use of the same IndexWriter. i.e. My
index Writer opens once in Step 4 and after that the whole process makes use
of it.
2. But i open indexReader for each deletion and close.
3. I optimize IndexWriter after certain threshold is crossed.

Now my problem is:
In the first deletion of document (if present) in step 2 and closing of
indexreader in step 3. I get no error.
But in the second loop, i get the error while trying to close the
IndexReader.

The error is :
Unable to cast object of type 'System.Collections.DictionaryEntry' to type
'System.String'.

Stack Trace:
at Lucene.Net.Index.IndexFileDeleter.DeleteFiles(ArrayList files)
at Lucene.Net.Index.IndexFileDeleter.DeleteFiles()
at Lucene.Net.Index.IndexFileDeleter.CommitPendingFiles()
at Lucene.Net.Index.IndexReader.Commit()
at Lucene.Net.Index.IndexReader.Close()
at QueryDatabaseForIndexing.Program.Main(String[] args) in E:\Test
Applications\ORS Lucene Developments\July 25\
TotalIndexingAndSearching_25_july\T otalIndexingAndSearching\
QueryDatabaseForIndexing \Program2.cs:line 159

I dont know whats the cause of this error.

I am in real need of help.
Please help me find error.



--
View this message in context: http://www.nabble.com/Strange-Error-while-deleting-Documents-from-index-while-indexing.-tf4149570.html#a11804824
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


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

Search Discussions

  • Doron Cohen at Jul 26, 2007 at 10:12 pm
    Seems like a Lucene.Net issue, better post there to
    solve this. One comment - must close the writer
    between iterations otherwise next attempt to delete
    a document with a reader will fail to obtain
    a write lock.

    miztaken <manish@ccnep.com.np> wrote on 25/07/2007 23:27:59:
    Hi,
    I am dumping the database tables into lucene documents.
    I am doing like this:

    1. Get the rowset from database to be stored as Lucene Document.
    2. Open IndexReader and check if they are already indexed.
    If Indexed, delete them and add the new rowset.
    Continue this till the end
    3. Close IndexReader
    4. Open IndexWriter
    5. Write the same rowset in the index.
    6. delete the rowset from database..
    7. Repeat the same process[step 1 - step 7 ] till there are records in
    database.


    Like this i am doing Indexing and deletion.
    Some key points:
    1. New indexWriter is opened when there is not instance of indexwriter
    available,but if available it makes use of the same IndexWriter. i.e. My
    index Writer opens once in Step 4 and after that the whole
    process makes use
    of it.
    2. But i open indexReader for each deletion and close.
    3. I optimize IndexWriter after certain threshold is crossed.

    Now my problem is:
    In the first deletion of document (if present) in step 2 and closing of
    indexreader in step 3. I get no error.
    But in the second loop, i get the error while trying to close the
    IndexReader.

    The error is :
    Unable to cast object of type 'System.Collections.
    DictionaryEntry' to type
    'System.String'.

    Stack Trace:
    at Lucene.Net.Index.IndexFileDeleter.DeleteFiles(ArrayList files)
    at Lucene.Net.Index.IndexFileDeleter.DeleteFiles()
    at Lucene.Net.Index.IndexFileDeleter.CommitPendingFiles()
    at Lucene.Net.Index.IndexReader.Commit()
    at Lucene.Net.Index.IndexReader.Close()
    at QueryDatabaseForIndexing.Program.Main(String[] args) in E:\Test
    Applications\ORS Lucene Developments\July 25\
    TotalIndexingAndSearching_25_july\T otalIndexingAndSearching\
    QueryDatabaseForIndexing \Program2.cs:line 159

    I dont know whats the cause of this error.

    I am in real need of help.
    Please help me find error.



    --
    View this message in context: http://www.nabble.com/Strange-
    Error-while-deleting-Documents-from-index-while-indexing.-
    tf4149570.html#a11804824
    Sent from the Lucene - Java Users mailing list archive at Nabble.com.


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

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Miztaken at Jul 27, 2007 at 6:12 am
    Where shall i post this issue.
    I am naive to Lucene.
    And about IndexWriter Closing.
    Now i am trying like this:

    1. Open New IndexReader.
    2. Delete Documents.
    3. Close IndexReader.
    4. Open New IndexWriter.
    5. Write Documents.
    6. Close IndexWriter.
    7. Repeat the process for n times the in nth time optimize the index before
    closing indexwriter.

    Is it acceptable.
    But according to the http://wiki.apache.org/lucene-java/ImproveIndexingSpeed
    It says to use only once instance of IndexWriter.
    But in my case, after each iteration i have to close my IndexWriter as you
    have suggested.
    Is this the only way to do this..
    Or is it that, using one instance of IndexWriter is only applicable while
    doing indexing without deleting documents..?
    Please make me clear.

    And another question..?
    What can be the possible scenario for threaded indexWriting and deleting
    context..?


    --
    View this message in context: http://www.nabble.com/Strange-Error-while-deleting-Documents-from-index-while-indexing.-tf4149570.html#a11823559
    Sent from the Lucene - Java Users mailing list archive at Nabble.com.


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Karl wettin at Jul 27, 2007 at 9:02 am
    27 jul 2007 kl. 10.50 skrev miztaken:
    My application simply shut downs.
    After that when i try to open the same index using IndexReader and
    fetch the
    document then it says "trying to access deleted document". After
    getting
    such error, i opened the indexWriter, optimized and then closed it.
    Then again i tried to get the documents using indexreader and its
    working
    all fine.

    What can be the problem.

    Well the pseudo code will be like:
    Can you please supply an isolated and working test case that
    demonstrate your problem?

    Can you use IndexWriter#deleteDocument instead?

    --
    karl

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Miztaken at Jul 27, 2007 at 11:43 am
    Can you use IndexWriter#deleteDocument instead?
    No i cant use this method.
    I dont know docid and i dont wanna search for it. It will only add extra
    time.
    I am deleting the document on the basis of unique key field.

    Can you please supply an isolated and working test case that
    demonstrate your problem?
    Well my application is used to index the database rowsets so i wont be able
    to give you running code but i have tried my best to keep it elaborative.
    Please check the attachment.
    I have attached a C# file.
    Please open with any text editor of your choice.
    Find the attachment here: http://www.nabble.com/file/p11827583/Program2.cs
    Program2.cs

    Please help me.

    --
    View this message in context: http://www.nabble.com/Strange-Error-while-deleting-Documents-from-index-while-indexing.-tf4149570.html#a11827583
    Sent from the Lucene - Java Users mailing list archive at Nabble.com.


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Karl wettin at Jul 27, 2007 at 11:58 am
    27 jul 2007 kl. 13.43 skrev miztaken:
    Can you use IndexWriter#deleteDocument instead?
    No i cant use this method.
    I dont know docid and i dont wanna search for it. It will only add
    extra
    time.
    I am deleting the document on the basis of unique key field.
    You can do that with IndexWriter#deleteDocuments(Term)

    And if Lucene.Net does not support that, can you try doing it by
    searching and deleting just to see how it changes the outcome?
    Can you please supply an isolated and working test case that
    demonstrate your problem?
    Find the attachment here: http://www.nabble.com/file/p11827583/
    Program2.cs
    That is a fairly large amount of code. And as it is C# I have nothing
    to test it on. Too much for me to compile and run in the head. I was
    hoping for a few line of code that demonstrated the problem and
    nothing else.


    --
    karl

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Chris Hostetter at Jul 30, 2007 at 8:27 am
    : Where shall i post this issue.

    you are currently posting to a list named "java-user" this is for "user"
    related questions about the "java" lucene project.

    if you have questions about "Lucene.Net" you should be asking them on the
    "Lucene.Net" user list...

    http://incubator.apache.org/lucene.net/
    http://mail-archives.apache.org/mod_mbox/incubator-lucene-net-user/




    -Hoss


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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedJul 26, '07 at 6:28a
activeJul 30, '07 at 8:27a
posts7
users4
websitelucene.apache.org

People

Translate

site design / logo © 2022 Grokbase