1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 """Support for queries on external services."""
21
22 from gettext import gettext as _
23
25 """Interface for querying external databases.
26
27 This queries uses Twisted's deferred mechanism to handle
28 asynchronous results. At most one query can run on a given
29 IExternal object at a time.
30 """
31
32 schema = ''
33
35 """Create a new external query interface.
36
37 Args:
38 db: Pyblio.Store.Database
39 """
40 assert db.schema.id == self.schema, \
41 _('invalid schema: %r instead of %r' % (
42 db.schema.id, self.schema))
43
45 """Return the number of matches for the specified query.
46
47 Args:
48 query: string
49 Return:
50 twisted.internet.defer.Deferred() -> int
51 """
52
53 - def search(self, query, maxhits=100):
54 """Return the number of matches for the specified query and a
55 ResultSet() with the records that have been retrieved (at most
56 maxhits).
57
58 Args:
59 query: string
60 maxhit: integer
61 Return:
62 (twisted.internet.defer.Deferred() -> int,
63 Pyblio.Store.ResultSet)
64 """
65
67 """Cancel a pending query."""
68