You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by "Moray McConnachie (JIRA)" <ji...@apache.org> on 2010/01/28 12:11:34 UTC

[jira] Created: (LUCENENET-338) Serialized queries function unreliably

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


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.


[jira] Updated: (LUCENENET-338) Serialized queries function unreliably

Posted by "Digy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENENET-338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Digy updated LUCENENET-338:
---------------------------

    Attachment:     (was: Term.patch)

> 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.


[jira] Closed: (LUCENENET-338) Serialized queries function unreliably

Posted by "Digy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENENET-338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Digy closed LUCENENET-338.
--------------------------

    Resolution: Fixed
      Assignee: Digy

Patches applied.
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
>            Assignee: Digy
>         Attachments: Term.patch, TestSupportClass.patch, TestSupportClass.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.


[jira] Updated: (LUCENENET-338) Serialized queries function unreliably

Posted by "Digy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENENET-338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Digy updated LUCENENET-338:
---------------------------

    Attachment: TestSupportClass.patch

> 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, TestSupportClass.patch, TestSupportClass.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.


[jira] Commented: (LUCENENET-338) Serialized queries function unreliably

Posted by "Digy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENENET-338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12806002#action_12806002 ] 

Digy commented on LUCENENET-338:
--------------------------------

Thanks.
Other potential serialization issues? I haven't run across one, but we try to fix them as soon as possible when reported.

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.


[jira] Commented: (LUCENENET-338) Serialized queries function unreliably

Posted by "Moray McConnachie (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENENET-338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12805987#action_12805987 ] 

Moray McConnachie commented on LUCENENET-338:
---------------------------------------------

Yes, this is fixed for my termquery example, great response time as always!

Are there other potential serialization issues do you think?

> 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.


[jira] Updated: (LUCENENET-338) Serialized queries function unreliably

Posted by "Digy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENENET-338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Digy updated LUCENENET-338:
---------------------------

    Attachment: TestSupportClass.patch

Test case.

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, TestSupportClass.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.


[jira] Issue Comment Edited: (LUCENENET-338) Serialized queries function unreliably

Posted by "Digy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENENET-338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12806083#action_12806083 ] 

Digy edited comment on LUCENENET-338 at 1/28/10 8:45 PM:
---------------------------------------------------------

Attached a test case.

DIGY

      was (Author: digydigy):
    Test case.

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, TestSupportClass.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.


[jira] Commented: (LUCENENET-338) Serialized queries function unreliably

Posted by "Digy (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Commented: (LUCENENET-338) Serialized queries function unreliably

Posted by "Digy (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENENET-338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12806064#action_12806064 ] 

Digy commented on LUCENENET-338:
--------------------------------

If no objections, I will commit the patch soon.

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.


[jira] Updated: (LUCENENET-338) Serialized queries function unreliably

Posted by "Digy (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENENET-338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Digy updated LUCENENET-338:
---------------------------

    Attachment: Term.patch

> 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, 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.