Mercurial > p > roundup > code
annotate roundup/backends/indexer_rdbms.py @ 7021:4e25815961a7
flake8: remove trailing whitespace; blank lines for definitions
E305 expected 2 blank lines after class or function definition, found 1
E306 expected 1 blank line before a nested definition, found 0
W291 trailing whitespace
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 09 Oct 2022 17:30:47 -0400 |
| parents | 8bda74ee7070 |
| children |
| rev | line source |
|---|---|
|
4089
eddb82d0964c
Add compatibility package to allow us to deal with Python versions 2.3..2.6.
Richard Jones <richard@users.sourceforge.net>
parents:
4008
diff
changeset
|
1 """ This implements the full-text indexer over two RDBMS tables. The first |
|
2093
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
2 is a mapping of words to occurance IDs. The second maps the IDs to (Class, |
|
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
3 propname, itemid) instances. |
|
4089
eddb82d0964c
Add compatibility package to allow us to deal with Python versions 2.3..2.6.
Richard Jones <richard@users.sourceforge.net>
parents:
4008
diff
changeset
|
4 """ |
|
eddb82d0964c
Add compatibility package to allow us to deal with Python versions 2.3..2.6.
Richard Jones <richard@users.sourceforge.net>
parents:
4008
diff
changeset
|
5 import re |
|
2093
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
6 |
|
3544
5cd1c83dea50
Features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
3414
diff
changeset
|
7 from roundup.backends.indexer_common import Indexer as IndexerBase |
|
5416
56c9bcdea47f
Python 3 preparation: unicode.
Joseph Myers <jsm@polyomino.org.uk>
parents:
5391
diff
changeset
|
8 from roundup.anypy.strings import us2u, u2s |
|
2093
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
9 |
| 6911 | 10 |
|
3544
5cd1c83dea50
Features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
3414
diff
changeset
|
11 class Indexer(IndexerBase): |
|
2093
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
12 def __init__(self, db): |
|
3544
5cd1c83dea50
Features and fixes.
Richard Jones <richard@users.sourceforge.net>
parents:
3414
diff
changeset
|
13 IndexerBase.__init__(self, db) |
|
2093
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
14 self.db = db |
|
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
15 self.reindex = 0 |
|
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
16 |
|
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
17 def close(self): |
|
4089
eddb82d0964c
Add compatibility package to allow us to deal with Python versions 2.3..2.6.
Richard Jones <richard@users.sourceforge.net>
parents:
4008
diff
changeset
|
18 """close the indexing database""" |
|
2093
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
19 # just nuke the circular reference |
|
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
20 self.db = None |
|
3295
a615cc230160
added Xapian indexer; replaces standard indexers if Xapian is available
Richard Jones <richard@users.sourceforge.net>
parents:
3092
diff
changeset
|
21 |
|
a615cc230160
added Xapian indexer; replaces standard indexers if Xapian is available
Richard Jones <richard@users.sourceforge.net>
parents:
3092
diff
changeset
|
22 def save_index(self): |
|
4089
eddb82d0964c
Add compatibility package to allow us to deal with Python versions 2.3..2.6.
Richard Jones <richard@users.sourceforge.net>
parents:
4008
diff
changeset
|
23 """Save the changes to the index.""" |
|
3295
a615cc230160
added Xapian indexer; replaces standard indexers if Xapian is available
Richard Jones <richard@users.sourceforge.net>
parents:
3092
diff
changeset
|
24 # not necessary - the RDBMS connection will handle this for us |
|
a615cc230160
added Xapian indexer; replaces standard indexers if Xapian is available
Richard Jones <richard@users.sourceforge.net>
parents:
3092
diff
changeset
|
25 pass |
|
3331
7bc09d5d9544
perform word splitting in unicode for national characters support
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3295
diff
changeset
|
26 |
|
2093
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
27 def force_reindex(self): |
|
4089
eddb82d0964c
Add compatibility package to allow us to deal with Python versions 2.3..2.6.
Richard Jones <richard@users.sourceforge.net>
parents:
4008
diff
changeset
|
28 """Force a reindexing of the database. This essentially |
|
2093
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
29 empties the tables ids and index and sets a flag so |
|
4089
eddb82d0964c
Add compatibility package to allow us to deal with Python versions 2.3..2.6.
Richard Jones <richard@users.sourceforge.net>
parents:
4008
diff
changeset
|
30 that the databases are reindexed""" |
|
2093
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
31 self.reindex = 1 |
|
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
32 |
|
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
33 def should_reindex(self): |
|
4089
eddb82d0964c
Add compatibility package to allow us to deal with Python versions 2.3..2.6.
Richard Jones <richard@users.sourceforge.net>
parents:
4008
diff
changeset
|
34 """returns True if the indexes need to be rebuilt""" |
|
2093
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
35 return self.reindex |
|
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
36 |
|
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
37 def add_text(self, identifier, text, mime_type='text/plain'): |
|
4089
eddb82d0964c
Add compatibility package to allow us to deal with Python versions 2.3..2.6.
Richard Jones <richard@users.sourceforge.net>
parents:
4008
diff
changeset
|
38 """ "identifier" is (classname, itemid, property) """ |
|
2093
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
39 if mime_type != 'text/plain': |
|
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
40 return |
|
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
41 |
|
3988
b50446ff16f4
fix comment, thanks alex
Richard Jones <richard@users.sourceforge.net>
parents:
3981
diff
changeset
|
42 # Ensure all elements of the identifier are strings 'cos the itemid |
|
3981
82e116d515d2
another psql 8.3 compat fix
Richard Jones <richard@users.sourceforge.net>
parents:
3718
diff
changeset
|
43 # column is varchar even if item ids may be numbers elsewhere in the |
|
82e116d515d2
another psql 8.3 compat fix
Richard Jones <richard@users.sourceforge.net>
parents:
3718
diff
changeset
|
44 # code. ugh. |
|
4008
0bf9f8ae7d1b
fix bug introduced in 1.4.5 in RDBMS full-text indexing;
Richard Jones <richard@users.sourceforge.net>
parents:
3988
diff
changeset
|
45 identifier = tuple(map(str, identifier)) |
|
3981
82e116d515d2
another psql 8.3 compat fix
Richard Jones <richard@users.sourceforge.net>
parents:
3718
diff
changeset
|
46 |
|
2093
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
47 # first, find the id of the (classname, itemid, property) |
|
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
48 a = self.db.arg |
|
2098
18addf2a8596
Implemented proper datatypes in mysql and postgresql backends...
Richard Jones <richard@users.sourceforge.net>
parents:
2093
diff
changeset
|
49 sql = 'select _textid from __textids where _class=%s and '\ |
| 6911 | 50 '_itemid=%s and _prop=%s' % (a, a, a) |
|
2093
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
51 self.db.cursor.execute(sql, identifier) |
|
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
52 r = self.db.cursor.fetchone() |
|
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
53 if not r: |
|
3617
f12722c7b9ee
improvements
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
54 # not previously indexed |
|
2098
18addf2a8596
Implemented proper datatypes in mysql and postgresql backends...
Richard Jones <richard@users.sourceforge.net>
parents:
2093
diff
changeset
|
55 id = self.db.newid('__textids') |
|
18addf2a8596
Implemented proper datatypes in mysql and postgresql backends...
Richard Jones <richard@users.sourceforge.net>
parents:
2093
diff
changeset
|
56 sql = 'insert into __textids (_textid, _class, _itemid, _prop)'\ |
| 6911 | 57 ' values (%s, %s, %s, %s)' % (a, a, a, a) |
|
2093
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
58 self.db.cursor.execute(sql, (id, ) + identifier) |
|
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
59 else: |
|
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
60 id = int(r[0]) |
|
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
61 # clear out any existing indexed values |
| 6911 | 62 sql = 'delete from __words where _textid=%s' % a |
|
2093
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
63 self.db.cursor.execute(sql, (id, )) |
|
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
64 |
|
3617
f12722c7b9ee
improvements
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
65 # ok, find all the unique words in the text |
|
5416
56c9bcdea47f
Python 3 preparation: unicode.
Joseph Myers <jsm@polyomino.org.uk>
parents:
5391
diff
changeset
|
66 text = us2u(text, "replace") |
|
4284
86e8b2a615fa
Fix Issue2550609, hopefully for real, this time.
Stefan Seefeld <stefan@seefeld.name>
parents:
4283
diff
changeset
|
67 text = text.upper() |
|
5416
56c9bcdea47f
Python 3 preparation: unicode.
Joseph Myers <jsm@polyomino.org.uk>
parents:
5391
diff
changeset
|
68 wordlist = [u2s(w) |
| 4282 | 69 for w in re.findall(r'(?u)\b\w{%d,%d}\b' |
| 6911 | 70 % (self.minlength, self.maxlength), |
| 71 text)] | |
|
4089
eddb82d0964c
Add compatibility package to allow us to deal with Python versions 2.3..2.6.
Richard Jones <richard@users.sourceforge.net>
parents:
4008
diff
changeset
|
72 words = set() |
|
2093
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
73 for word in wordlist: |
| 6911 | 74 if self.is_stopword(word): |
| 75 continue | |
|
3617
f12722c7b9ee
improvements
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
76 words.add(word) |
|
2093
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
77 |
|
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
78 # for each word, add an entry in the db |
| 6911 | 79 sql = 'insert into __words (_word, _textid) values (%s, %s)' % (a, a) |
|
3617
f12722c7b9ee
improvements
Richard Jones <richard@users.sourceforge.net>
parents:
3544
diff
changeset
|
80 words = [(word, id) for word in words] |
|
3618
b31a2e35be80
pysqlite 1.1.6 does not allow to pass a list of tuples to cursor.execute().
Alexander Smishlajev <a1s@users.sourceforge.net>
parents:
3617
diff
changeset
|
81 self.db.cursor.executemany(sql, words) |
|
2093
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
82 |
|
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
83 def find(self, wordlist): |
|
4089
eddb82d0964c
Add compatibility package to allow us to deal with Python versions 2.3..2.6.
Richard Jones <richard@users.sourceforge.net>
parents:
4008
diff
changeset
|
84 """look up all the words in the wordlist. |
|
2093
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
85 If none are found return an empty dictionary |
|
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
86 * more rules here |
|
4089
eddb82d0964c
Add compatibility package to allow us to deal with Python versions 2.3..2.6.
Richard Jones <richard@users.sourceforge.net>
parents:
4008
diff
changeset
|
87 """ |
|
3033
f8d0fd056ac0
fix indexer searching with no valid words [SF#1086787]
Richard Jones <richard@users.sourceforge.net>
parents:
2872
diff
changeset
|
88 if not wordlist: |
|
4008
0bf9f8ae7d1b
fix bug introduced in 1.4.5 in RDBMS full-text indexing;
Richard Jones <richard@users.sourceforge.net>
parents:
3988
diff
changeset
|
89 return [] |
|
3033
f8d0fd056ac0
fix indexer searching with no valid words [SF#1086787]
Richard Jones <richard@users.sourceforge.net>
parents:
2872
diff
changeset
|
90 |
| 6911 | 91 cap_wl = [word.upper() for word in wordlist |
| 92 if self.minlength <= len(word) <= self.maxlength] | |
| 93 clean_wl = [word for word in cap_wl if not self.is_stopword(word)] | |
|
2093
3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
94 |
| 6911 | 95 if not clean_wl: |
|
4008
0bf9f8ae7d1b
fix bug introduced in 1.4.5 in RDBMS full-text indexing;
Richard Jones <richard@users.sourceforge.net>
parents:
3988
diff
changeset
|
96 return [] |
|
3048
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
97 |
|
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
98 if self.db.implements_intersect: |
|
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
99 # simple AND search |
| 6911 | 100 sql = 'select distinct(_textid) from __words where _word=%s' % ( |
| 101 self.db.arg) | |
| 102 sql = '\nINTERSECT\n'.join([sql]*len(clean_wl)) | |
| 103 self.db.cursor.execute(sql, tuple(clean_wl)) | |
|
3048
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
104 r = self.db.cursor.fetchall() |
|
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
105 if not r: |
|
4008
0bf9f8ae7d1b
fix bug introduced in 1.4.5 in RDBMS full-text indexing;
Richard Jones <richard@users.sourceforge.net>
parents:
3988
diff
changeset
|
106 return [] |
|
3048
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
107 a = ','.join([self.db.arg] * len(r)) |
|
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
108 sql = 'select _class, _itemid, _prop from __textids '\ |
| 6911 | 109 'where _textid in (%s)' % a |
|
3718
0d561b24ceff
support sqlite3
Richard Jones <richard@users.sourceforge.net>
parents:
3618
diff
changeset
|
110 self.db.cursor.execute(sql, tuple([int(row[0]) for row in r])) |
|
3048
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
111 |
|
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
112 else: |
| 6911 | 113 # A more complex version for MySQL since it doesn't |
| 114 # implement INTERSECT | |
|
3048
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
115 |
|
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
116 # Construct SQL statement to join __words table to itself |
|
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
117 # multiple times. |
|
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
118 sql = """select distinct(__words1._textid) |
|
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
119 from __words as __words1 %s |
|
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
120 where __words1._word=%s %s""" |
|
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
121 |
|
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
122 join_tmpl = ' left join __words as __words%d using (_textid) \n' |
|
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
123 match_tmpl = ' and __words%d._word=%s \n' |
|
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
124 |
|
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
125 join_list = [] |
|
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
126 match_list = [] |
| 6911 | 127 for n in range(len(clean_wl) - 1): |
|
3048
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
128 join_list.append(join_tmpl % (n + 2)) |
|
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
129 match_list.append(match_tmpl % (n + 2, self.db.arg)) |
|
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
130 |
| 6911 | 131 sql = sql % (' '.join(join_list), self.db.arg, |
| 132 ' '.join(match_list)) | |
| 133 self.db.cursor.execute(sql, clean_wl) | |
|
3048
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
134 |
|
4357
13b3155869e0
Beginnings of a big code cleanup / modernisation to make 2to3 happy
Richard Jones <richard@users.sourceforge.net>
parents:
4284
diff
changeset
|
135 r = [x[0] for x in self.db.cursor.fetchall()] |
|
3048
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
136 if not r: |
|
4008
0bf9f8ae7d1b
fix bug introduced in 1.4.5 in RDBMS full-text indexing;
Richard Jones <richard@users.sourceforge.net>
parents:
3988
diff
changeset
|
137 return [] |
|
3048
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
138 |
|
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
139 a = ','.join([self.db.arg] * len(r)) |
|
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
140 sql = 'select _class, _itemid, _prop from __textids '\ |
| 6911 | 141 'where _textid in (%s)' % a |
|
3048
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
142 |
|
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
143 self.db.cursor.execute(sql, tuple(map(int, r))) |
|
d9b4224f955c
merge from maint-0-8
Richard Jones <richard@users.sourceforge.net>
parents:
3033
diff
changeset
|
144 |
|
3076
2817a4db901d
Change indexer_common.search() to take a list of nodeids...
Johannes Gijsbers <jlgijsbers@users.sourceforge.net>
parents:
3048
diff
changeset
|
145 return self.db.cursor.fetchall() |
