MCPcopy Create free account
hub / github.com/BIT-DataLab/LakeBench / add_to_query_buffer

Method add_to_query_buffer

join/LSH/datasketch/lsh.py:213–233  ·  view source on GitHub ↗

Giving the MinHash of the query set, buffer queries to retrieve the keys that references sets with Jaccard similarities greater than the threshold. Buffered queries can be executed using `collect_query_buffer`. The combination of these functi

(self, minhash)

Source from the content-addressed store, hash-verified

211 return list(candidates)
212
213 def add_to_query_buffer(self, minhash):
214 '''
215 Giving the MinHash of the query set, buffer
216 queries to retrieve the keys that references
217 sets with Jaccard similarities greater than
218 the threshold.
219
220 Buffered queries can be executed using
221 `collect_query_buffer`. The combination of these
222 functions is way faster if cassandra backend
223 is used with `shared_buffer`.
224
225 Args:
226 minhash (datasketch.MinHash): The MinHash of the query set.
227 '''
228 if len(minhash) != self.h:
229 raise ValueError("Expecting minhash with length %d, got %d"
230 % (self.h, len(minhash)))
231 for (start, end), hashtable in zip(self.hashranges, self.hashtables):
232 H = self._H(minhash.hashvalues[start:end])
233 hashtable.add_to_select_buffer([H])
234
235 def collect_query_buffer(self):
236 '''

Callers

nothing calls this directly

Calls 1

add_to_select_bufferMethod · 0.45

Tested by

no test coverage detected