lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <cutt...@lucene.com>
Subject Re: HitCollector not serializable (Bug?)
Date Mon, 16 Jun 2003 17:17:09 GMT
The HitCollector-based search API is not meant to work remotely.  To do 
so would involve an RPC-callback for every non-zero score, which would 
be extremely expensive.  Also, just making HitCollector serializable 
would not be sufficient.  You'd also need to pass in a HitCollector 
implementation that subclasses UnicastRemoteObject, so that the 
callbacks can return to the original VM.

So, if you can, it's considerably simpler and more efficient to use 
TopDocs-based search when you're working remotely.

Doug

lucene@fantasymail.de wrote:
> Hi,
> 
> i tried Lucene 1.3 RC1.
> 
> There seems to be a bug in
> org.apache.lucene.search.RemoteSearchable.search(). 
> 
> Here is my code:
>    Searchable searcher =
>       (Searchable) Naming.lookup(args[0]);
>    Analyzer analyzer = new StandardAnalyzer();
>    Query query = QueryParser.parse("term", "content", analyzer);
>    HitCollector hc = new HitCollector()
>    {
>       public void collect(int doc, float score)
>       {
>            //bits.set(doc);
>       }
>    };
> 
>    searcher.search(query, (DateFilter)null, hc);
> 
> I'm getting the following exception:
> 
> java.rmi.MarshalException: error marshalling arguments; nested exception
>  is: java.io.NotSerializableException:
>  com.entwickler.lucenebuch.remote.SearchClient$1
>          at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:129)
>          at org.apache.lucene.search.RemoteSearchable_Stub.search(Unknown
>  Source)
>          at
>  com.entwickler.lucenebuch.remote.SearchClient.main(SearchClient.java:47)
>  Caused by: java.io.NotSerializableException:
>  com.entwickler.lucenebuch.remote.SearchClient$1
>          at
>  java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
>          at
>  java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278) at
>  sun.rmi.server.UnicastRef.marshalValue(UnicastRef.java:265) at
>  sun.rmi.server.UnicastRef.invoke(UnicastRef.java:124)
> 
> 
> This happens because org.apache.lucene.search.HitCollector is not
> serializable.
> 
> 
> Greetings
> Manfred
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message