The sim_server Module — pysimsearch v0.30 documentation

### Navigation

- index
- modules |
- next |
- previous |
- pysimsearch v0.30 documentation »

# The `sim_server` Module

SimServer

Server wrapper for pysimsearch modules. Currently, only provides access to sim_index.

Sample session:

Server

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

jsonrpclib Client

    >>> from pprint import pprint
    >>> import jsonrpclib
    >>> server = jsonrpclib.Server('http://localhost:9001/RPC2')
    >>> server.sim_index.index_filenames('http://www.stanford.edu/', 'http://www.berkeley.edu', 'http://www.ucla.edu')
    >>> pprint(server.sim_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]]

** pysimsearch Client ** >>> 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_server.` `RequestHandler`(request, client_address, server)

class `pysimsearch.sim_server.` `SimIndexService`

  Provide access to sim_index as an RPC service

`pysimsearch.sim_server.` `main`()

`pysimsearch.sim_server.` `start_sim_index_server`(port, logRequests=True)

### Navigation

- index
- modules |
- next |
- previous |
- pysimsearch v0.30 documentation »