[
https://issues.apache.org/jira/browse/LUCENENET-338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12805955#action_12805955
]
Digy commented on LUCENENET-338:
--------------------------------
Hi Moray,
Can you test the patch?
DIGY
> Serialized queries function unreliably
> --------------------------------------
>
> Key: LUCENENET-338
> URL: https://issues.apache.org/jira/browse/LUCENENET-338
> Project: Lucene.Net
> Issue Type: Bug
> Environment: Current trunk, standard .NET environment, Visual Studio
> 2008.
> Reporter: Moray McConnachie
> Attachments: Term.patch
>
>
> I've just tried slotting in current trunk in place of 2.3.1 we were using
> previously. Everything appears to compile and work OK, but the results are
> not correct when we introduce query serialization.
> Executing a simple BooleanQuery: +titling:Russia
> Results returned from query when not serialised: 3878 (correct)
> Results returned when query serialised deserialized and run with same
> Searcher: 3879
> Results returned when query serialised deserialized and run with new
> Searcher: 3 (!)
> Last time we had an issue with serialized queries and filed a bug report
> (https://issues.apache.org/jira/browse/LUCENENET-170), it was an issue with
> the serialization of Parameter on which Occur depends, but Parameter looks
> still to have the patch in as far as I can tell.
>
> *Test code*
> string
> IndexPath=@"C:\SourceSafeWork\OxanOxweb\LuceneAndSearch\TEST\LuceneIndexWithFullTextSince2004";
>
> //setup first query
> BooleanQuery lucQuery = new BooleanQuery();
> lucQuery.Add(new BooleanClause(new TermQuery(new
> Lucene.Net.Index.Term("titling","russia")),BooleanClause.Occur.MUST));
> //serialize and deserialize
> BinaryFormatter bf = new BinaryFormatter();
> System.IO.MemoryStream ms = new System.IO.MemoryStream();
> bf.Serialize(ms, lucQuery);
> ms.Seek(0, System.IO.SeekOrigin.Begin);
> Query lucQuery2 = (Query)bf.Deserialize(ms);
> ms.Close();
> //get hit counts for 2 searches
> IndexSearcher searcher = new IndexSearcher();
> int hitCount = searcher.Search(lucQuery, 20).totalHits; //3878 hits
> //bizarrely if I do not close the searcher and reopen the hit count is only
> 1 different i.e. 3879
> searcher.Close();
> searcher = new IndexSearcher(@IndexPath);
> int hitCount2 = searcher.Search(lucQuery2, 20).totalHits; //3 hits
> if (hitCount != hitCount2)
> MessageBox.Show("Error in serialisation - different hit count");
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.