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)
| 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 | ''' |
nothing calls this directly
no test coverage detected