The RemoteSimIndex Class

RemoteSimIndex

Sample usage:

Server

bash$ pysimsearch/sim_server.py sim_index -p 9001
Use Control-C to exit

** pysimsearch Client **

>>> from pprint import pprint
>>> from pysimsearch import sim_index
>>> index = sim_index.RemoteSimIndex('http://localhost:9001/RPC2')
>>> index.index_filenames('http://www.stanford.edu/', 'http://www.berkeley.edu', 'http://www.ucla.edu')
>>> pprint(index.query_by_string('university'))
[[u'http://www.stanford.edu/', 0.10469570845856098],
 [u'http://www.ucla.edu', 0.04485065887313478],
 [u'http://www.berkeley.edu', 0.020464326883958977]]
class pysimsearch.sim_index.RemoteSimIndex(server_url)

Proxy to a remote pysimsearch.sim_index.SimIndex

RemoteSimIndex is compatible with the SimIndex interface, and provides access to a remote index. We use this in place of directly using a jsonrpclib.Server() object because we need an object that acts like type SimIndex.

Instantiate a RemoteSimIndex as follows:

>>> remote_index = RemoteSimIndex('http://localhost:9001/RPC2')
>>> remote_index.query_by_string('university')
...

Previous topic

The ShelfSimIndex Class

Next topic

The SimIndexCollection Class

This Page