You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by "Philip Todd (JIRA)" <ji...@apache.org> on 2009/03/10 11:14:50 UTC

[jira] Issue Comment Edited: (LUCENENET-174) RAMDirectory Not Correctly Serilizing

    [ https://issues.apache.org/jira/browse/LUCENENET-174?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12680417#action_12680417 ] 

Philip Todd edited comment on LUCENENET-174 at 3/10/09 3:14 AM:
----------------------------------------------------------------

I'm not sure what the procedure is (if any) for submitting patches so I'm attaching 3 files containing a fix for the bug. They are in a zip file. They should all be placed in the Store directory.

Directory.cs
LockFactory.cs
SingleInstanceLockFactory.cs

Please let me know if I can do anything else.



      was (Author: philip.todd):
    3 files containing fix for error serializing RamDirectory:
Directory.cs
LockFactory.cs
singleInstanceLockFactory.cs


  
> RAMDirectory Not Correctly Serilizing
> -------------------------------------
>
>                 Key: LUCENENET-174
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-174
>             Project: Lucene.Net
>          Issue Type: Bug
>         Environment: Lucene.Net version 2.1
> Windows XP 64Bit SP2
> Visual Studio 2008 SP1
> DOTNET 3.5 SP1
> NCache Developer 3.4
>            Reporter: Philip Todd
>            Priority: Minor
>         Attachments: Store.zip
>
>   Original Estimate: 0.17h
>  Remaining Estimate: 0.17h
>
> Greetings. Firstly a big thank you for everyones efforts with Lucene and Lucene.Net. Your efforts are much appreciated.
> Background:
> I have created a server application which allows searching across many companies. In order to achieve this I have utilized Lucene.Net for indexing and searching and NCache from Alachisoft for caching the information server-side. As the Lucene index takes a fair amount of time to create - I am also caching the RAMDirectory. The caching requires all objects to be serialized before storage.
> The issue:
> After retrieving the RAMDirectory from cache (after de-serializing) I attempted to create a new IndexWriter object to allow adding more items to the index:
>             oDirectory = CacheConfig.DeCacheSupplierIndex("SupplierIndex" & Supplier.BuyerNo)
>             analyzer = New StandardAnalyzer()
>             oIndexWriter = New IndexWriter(oDirectory, analyzer, False)
> The attempt to create the IndexWriter resulted in a NullReference exception at:
>            at Lucene.Net.Store.Directory.MakeLock(String name)
>            at Lucene.Net.Index.IndexWriter.Init(Directory d, Analyzer a, Boolean create, Boolean closeDir)
>            at Lucene.Net.Index.IndexWriter..ctor(Directory d, Analyzer a)
>    
> After debugging the Lucene source I discovered the exception was caused by the lockFactory definition in the Directory class (Directory.cs line 49) having a [NonSerialized] attribute. This caused the lockFactory to be null after serialization.
> Fix:
> Removed the [NonSerialized] attribute. 
> Added a [Serializable] attribute to SingleInstanceLockFactory (SingleInstanceLockFactory.cs line 35)
> Added a [Serializable] attribute to LockFactory (LockFactory.cs line 28)
> This allowed me to proceed. I have not thoroughly tested the changes. I can provide the source code if required.
> As we will very likely upgrade to future versions of Lucene - I would like to have any fix incorporated into the Lucene source repository. Let me know what I should do.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.