Skip to content
This repository has been archived by the owner on Jul 28, 2022. It is now read-only.

All documents returned from LuceneMediator<T>.ToDocument() calls reference the last processed item #10

Open
GoogleCodeExporter opened this issue Apr 15, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?

  In the following code sample:

    var obj1 = new TestRecord { Data = "foo1", Data2 = "bar1" };
    var doc1 = LuceneMediator<TestRecord>.ToDocument(obj1);

    var obj2 = new TestRecord { Data = "foo2", Data2 = "bar2" };
    var doc2 = LuceneMediator<TestRecord>.ToDocument(obj2);


What is the expected output?

  I expect doc1 to have Data == "foo1".


What do you see instead?

  doc1 is equal to "foo2". If 10,000 of these are done, all ten thousand Document's contain the last processed object's data.


What version of the product are you using?
  ActiveLucene.Net_0.1.802.8603

On what operating system?
  Windows 7

Please provide any additional information below.

  Workaround: Add the Document to the index before using the mediator on another object. This seems to cause the data to get copied out of reach of getting blitzed by the next mediator call. This is the technique I am doing for now. The attribute decorators make a lot of sense, they should add them into the core project.

  Suspected Problem: I suspect each Document returned from ToDocument contains a reference to static members within the LuceneMediator class, resulting in all returned Document's ultimately pointing to a single set of property data (from the last processed object). The returned Document needs to be decoupled from the LuceneMediator class.

Original issue reported on code.google.com by [email protected] on 28 May 2011 at 1:38

@GoogleCodeExporter
Copy link
Author

Original comment by [email protected] on 8 Aug 2011 at 4:49

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant