lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hongwei Shen" <hs...@geosign.com>
Subject RE: Serialization exception for distributed Lucene index
Date Thu, 13 Sep 2007 14:57:35 GMT
I resolved the problem. The culprit is the IComparable type in the
returned result. I hope someone can make the change for the new version
of Lucene. The details is as follow:

In file "FieldSortedHitQueue.cs" line 294, change line of code
"System.IComparable [] fields = new System.IComparable [n];" to
"Object [] fields = new Object[n];"

		internal virtual FieldDoc FillFields(FieldDoc doc)
		{
			int n = comparators.Length;
			System.IComparable [] fields = new
System.IComparable [n];
			for (int i = 0; i < n; ++i)
				fields[i] =
(object)comparators[i].SortValue(doc);
			doc.fields = fields;
			//if (maxscore > 1.0f) doc.score /= maxscore;
// normalize scores
			return doc;
		}

And change the type of FieldDoc.fields from IComparable to Object, there
are implied changes somewhere else, just make it compile.

The method FillFields is called to fill the SortValues in the
TopFieldDocs before result is returned. It seems that .net
deserialization has problem to distinguish the real type and the casted
type. 

Please note that don't try this: object [] fileds = new new
System.IComparable [n]; it took me one day to figure out that this
doesn't work. In simple, the type of fields in FieldDoc must be object
[] and the newed type for that field must be object [] too, casting to
object [] doesn't work. 


-----Original Message-----
From: Hongwei Shen [mailto:hshen@geosign.com] 
Sent: 2007-09-12 21:23
To: lucene-net-dev@incubator.apache.org
Subject: RE: Serialization exception for distributed Lucene index 

I am on version 2.0.0.4. How to search the mail archive? Send email to
some email or there is a web site of it? 

-----Original Message-----
From: George Aroush [mailto:george@aroush.net] 
Sent: 2007-09-12 18:34
To: lucene-net-dev@incubator.apache.org
Subject: RE: Serialization exception for distributed Lucene index 

What version (and build) of Lucene.Net are you using?  A while back
there
someone reported an issue with SortField and remoting which was fixed --
sorry, I don't recall the details but you can search email archive if
you
want to find out.  However, if you are on the latest version which is
2.0
build 4 then you have the fix.

-- George

> -----Original Message-----
> From: Hongwei Shen [mailto:hshen@geosign.com] 
> Sent: Wednesday, September 12, 2007 5:29 PM
> To: lucene-net-dev@incubator.apache.org
> Subject: RE: Serialization exception for distributed Lucene index 
> 
> No, the configuration problem is ruled out. As I said, the 
> first method that without Sort parameter works fine. The 
> difference between the two methods are that the return types 
> are different.
> 
> I suspect that something wrong with the SortField or 
> TopFieldDocs. It is like some type is not consistent in 
> serialization and de-serilization, a good example is 
> IComaprable type, it maybe float or integer or any type that 
> implemented IComparable.
> 
> Thanks for the quick response although.  
> 
> -----Original Message-----
> From: DIGY [mailto:digydigy@gmail.com]
> Sent: 2007-09-12 17:18
> To: lucene-net-dev@incubator.apache.org
> Subject: RE: Serialization exception for distributed Lucene index 
> 
> Hi,
> 
> Do you use custom sinks(encryption, compression etc.) or 
> callbacks(events)?
> This type of exceptions often stem from misconfigured 
> remoting applications.
> 
> DIGY 
> 
> 
> -----Original Message-----
> From: Hongwei Shen [mailto:hshen@geosign.com]
> Sent: Wednesday, September 12, 2007 11:49 PM
> To: lucene-net-dev@incubator.apache.org
> Subject: Serialization exception for distributed Lucene index 
> 
> We are using distributed Lucene.net and we have Master Index 
> Server which takes responsibility of distributing the index 
> searching to multiple Index Servers by calling the remote 
> method Search(...) of the Index Server. It is when the Master 
> Server de-serializing the response message from the Index 
> Server, we got the following SerializationException. 
> 
>  
> 
> The Search method is overloaded:
> 
>  
> 
> TopDocs docs = searchable.Search(weight, filter, nDocs);
> 
> TopFieldDocs fDocs = searchable.Search(weight, filter, nDocs, sort);
> 
>  
> 
> TopDocs is the parent class of TopFieldDocs. The difference 
> is that the second method takes an extra parameters of type 
> Sort and returns the child type TopFieldDocs of TopDocs. The 
> first method works properly.
> Tracing shows that result on the IndexServer is properly 
> generated for the second method.
> 
>  
> 
> Any one knows the issue or how to debug the issue? 
> 
>  
> 
> System.Runtime.Serialization.SerializationException: Binary 
> stream '99'
> does not contain a valid BinaryHeader. Possible causes are 
> invalid stream or object version change between serialization 
> and deserialization.
> 
>  
> 
> Server stack trace: 
> 
>    at
> System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
> 
>    at
> System.Runtime.Serialization.Formatters.Binary.ObjectReader.De
> serialize(
> HeaderHandler handler, __BinaryParser serParser, Boolean 
> fCheck, Boolean isCrossAppDomain, IMethodCallMessage 
> methodCallMessage)
> 
>    at
> System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
> .Deseriali
> ze(Stream serializationStream, HeaderHandler handler, Boolean 
> fCheck, Boolean isCrossAppDomain, IMethodCallMessage 
> methodCallMessage)
> 
>    at
> System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinary
> ResponseMe
> ssage(Stream inputStream, IMethodCallMessage reqMsg, Boolean
> bStrictBinding)
> 
>    at
> System.Runtime.Remoting.Channels.BinaryClientFormatterSink.Syn
> cProcessMe
> ssage(IMessage msg)
> 
>  
> 
> Exception rethrown at [0]: 
> 
>    at
> System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
> reqMsg, IMessage retMsg)
> 
>    at
> System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
> msgData, Int32 type)
> 
>    at Lucene.Net.Search.Searchable.Search(Weight weight, 
> Filter filter,
> Int32 n, Sort sort)
> 
>    at Lucene.Net.Search.MultiSearcherThread.Run() in 
> C:\Dev\TrueLocal\TrueLocal.Lucene.Net-2.0.0\Search\ParallelMul
> tiSearcher
> .cs:line 278
> 
>  
> 
>  
> 
> 


Mime
View raw message