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 and deserialized: 3
Last time this happened 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:
//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(@"C:\SourceSafeWork\OxanOxweb\LuceneAndSearch\TEST\LuceneI
ndexWithFullTextSince2004");
int hitCount = searcher.Search(lucQuery, 20).totalHits;
//bizarrely if I do not close the searcher and reopen the hit count is
only 1 different
searcher.Close();
searcher = new
IndexSearcher(@"C:\SourceSafeWork\OxanOxweb\LuceneAndSearch\TEST\LuceneI
ndexWithFullTextSince2004");
int hitCount2 = searcher.Search(lucQuery2, 20).totalHits;
if (hitCount != hitCount2)
MessageBox.Show("Error in serialisation - different hit count");
-------------------------------------
Moray McConnachie
Director of IT +44 1865 261 600
Oxford Analytica http://www.oxan.com