Changeset 302
- Timestamp:
- 02/23/08 19:53:02 (9 months ago)
- Files:
-
- 1 modified
-
trunk/tutorial/py/BookmarkExample.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tutorial/py/BookmarkExample.py
r290 r302 140 140 def find(self, terms, random=False, sortby=None): 141 141 print "\nSearching for:", terms 142 for k,v in options.iteritems():143 print "\t", k, v144 142 145 143 t0 = time() … … 148 146 q.index = THRUDEX_INDEX 149 147 q.query = terms 150 151 #q.limit = 100152 #q.offset = 10153 148 154 149 if random: … … 161 156 return 162 157 163 print "Found ", ids.total, "bookmarks"158 print "Found %d bookmarks" % ids.total 164 159 165 160 if len(ids.elements) > 0: 166 bm_strs = self.thrudoc.fetchList( self.create_doc_list(ids.elements)) 167 bms = [self.deserialize(bs) for bs in bm_strs] 161 list_response = self.thrudoc.getList( self.create_doc_list(ids.elements)) 162 bms = [] 163 for ele in list_response: 164 if ele.element.value != '': 165 bms.append(self.deserialize(ele.element.value)) 166 else: 167 print 'value empty for key: %s' % ele.element.key 168 168 self.print_bookmarks(bms) 169 169 … … 174 174 def create_doc_list(self, ids): 175 175 docs = [] 176 for idin enumerate(ids):176 for pointer, ele in enumerate(ids): 177 177 doc = ThrudocTypes.Element() 178 178 doc.bucket = THRUDOC_BUCKET 179 doc.key = id179 doc.key = ele.key 180 180 docs.append(doc) 181 181
