void euclid_lsh::neighbor_row( const common::sfv_t& query, vector<pair<string, float> >& ids, uint64_t ret_num) const { neighbor_row_from_hash( cosine_lsh(query, hash_num_), l2norm(query), ids, ret_num); }
void bit_vector_nearest_neighbor_base::neighbor_row( const string& query_id, vector<pair<string, float> >& ids, uint64_t ret_num) const { const table::column_table& table = *get_const_table(); const pair<bool, uint64_t> maybe_index = table.exact_match(query_id); if (!maybe_index.first) { ids.clear(); return; } const_bit_vector_column& col = bit_vector_column(); neighbor_row_from_hash(col[maybe_index.second], ids, ret_num); }
void euclid_lsh::neighbor_row( const common::sfv_t& query, vector<pair<string, float> >& ids, uint64_t ret_num) const { util::concurrent::scoped_rlock lk(get_const_table()->get_mutex()); /* table lock acquired; all subsequent table operations must be nolock */ neighbor_row_from_hash( cosine_lsh(query, hash_num_, threads_, cache_), l2norm(query), ids, ret_num); }
void euclid_lsh::neighbor_row( const std::string& query_id, vector<pair<string, float> >& ids, uint64_t ret_num) const { const pair<bool, uint64_t> maybe_index = get_const_table()->exact_match(query_id); if (!maybe_index.first) { ids.clear(); return; } const bit_vector bv = lsh_column()[maybe_index.second]; const float norm = norm_column()[maybe_index.second]; neighbor_row_from_hash(bv, norm, ids, ret_num); }
void euclid_lsh::neighbor_row( const std::string& query_id, vector<pair<string, float> >& ids, uint64_t ret_num) const { util::concurrent::scoped_rlock lk(get_const_table()->get_mutex()); /* table lock acquired; all subsequent table operations must be nolock */ const pair<bool, uint64_t> maybe_index = get_const_table()->exact_match_nolock(query_id); if (!maybe_index.first) { ids.clear(); return; } const bit_vector bv = lsh_column()[maybe_index.second]; const float norm = norm_column()[maybe_index.second]; neighbor_row_from_hash(bv, norm, ids, ret_num); }
void bit_vector_nearest_neighbor_base::neighbor_row( const common::sfv_t& query, vector<pair<string, float> >& ids, uint64_t ret_num) const { neighbor_row_from_hash(hash(query), ids, ret_num); }