[pylucene-dev] serialize Lucene objects

Andrzej Bialecki ab at getopt.org
Thu Jan 20 14:09:42 PST 2005

Yura Smolsky wrote:
> Hello, Victor.
> How? :)
> I need to pass Query, Document, Hit objects to methods of interface. But I have
> no idea how to pass them..

I'm not up-to-date on the current state of pyLucene, but generally 
speaking the Hits object is not usable remotely, i.e. you can't 
serialize/deserialize it and just expect it to work. I believe this is 
true for both Java Lucene and pyLucene.

The reason is that the Hits object contains only id's of matching 
documents and their scores, and not the full Document's, so when you 
call Hits.doc(i) you actually access the underlying (local) IndexReader. 
If you wanted to use the same instance but on remote machine, it 
wouldn't be able to access the local IndexReader, and it would blow.

> Maybe you have alternative way of building of such interface.
> Can you describe in short your proposal?..

I would use some binary made-up protocol, or XML-RPC, or perhaps CORBA 
(if I only knew how to use this one ;) The idea would be the same in all 
cases - to provide remote facade (or stubs) which would call remote 
objects to deliver data bit by bit as requested.

Best regards,
Andrzej Bialecki
  ___. ___ ___ ___ _ _   __________________________________
[__ || __|__/|__||\/|  Information Retrieval, Semantic Web
___|||__||  \|  ||  |  Embedded Unix, System Integration
http://www.sigram.com  Contact: info at sigram dot com

More information about the pylucene-dev mailing list