func (s *Store) Find(sig uint64) []uint64 {

	// empty store
	if len(s.docids) == 0 {
		return nil
	}

	var ids []uint64

	// TODO(dgryski): search in parallel
	var t int
	for i := 0; i < 4; i++ {
		p := sig
		ids = append(ids, s.unshuffleList(s.rhashes[t].find(p, mask3, 3), t)...)
		t++

		p = (sig & 0xffff000000ffffff) | (sig & 0x0000fff000000000 >> 12) | (sig & 0x0000000fff000000 << 12)
		ids = append(ids, s.unshuffleList(s.rhashes[t].find(p, mask3, 3), t)...)
		t++

		p = (sig & 0xffff000fff000fff) | (sig & 0x0000fff000000000 >> 24) | (sig & 0x0000000000fff000 << 24)
		ids = append(ids, s.unshuffleList(s.rhashes[t].find(p, mask3, 3), t)...)
		t++

		p = (sig & 0xffff000ffffff000) | (sig & 0x0000fff000000000 >> 36) | (sig & 0x0000000000000fff << 36)
		ids = append(ids, s.unshuffleList(s.rhashes[t].find(p, mask3, 3), t)...)
		t++

		sig = (sig << 16) | (sig >> (64 - 16))
	}

	ids = unique(ids)

	var docids []uint64
	for _, v := range ids {
		docids = append(docids, s.docids.find(v)...)
	}

	return docids
}
// Find searches the store for all hashes hamming distance 3 or less from the
// query signature.  It returns the associated list of document ids.
Find searches the store for all hashes hamming distance 3 or less from the
query signature.  It returns the associated list of document ids.
// Find searches the store for all hashes hamming distance 3 or less from the // query signature . It returns the associated list of document ids .
func (s *Store) Find(sig uint64) []uint64 {
	if len(s.docids) == 0 {
		return nil
	}
	var ids []uint64
	var t int
	for i := 0; i < 4; i++ {
		p := sig
		ids = append(ids, s.unshuffleList(s.rhashes[t].find(p, mask3, 3), t)...)
		t++
		p = (sig & 0xffff000000ffffff) | (sig & 0x0000fff000000000 >> 12) | (sig & 0x0000000fff000000 << 12)
		ids = append(ids, s.unshuffleList(s.rhashes[t].find(p, mask3, 3), t)...)
		t++
		p = (sig & 0xffff000fff000fff) | (sig & 0x0000fff000000000 >> 24) | (sig & 0x0000000000fff000 << 24)
		ids = append(ids, s.unshuffleList(s.rhashes[t].find(p, mask3, 3), t)...)
		t++
		p = (sig & 0xffff000ffffff000) | (sig & 0x0000fff000000000 >> 36) | (sig & 0x0000000000000fff << 36)
		ids = append(ids, s.unshuffleList(s.rhashes[t].find(p, mask3, 3), t)...)
		t++
		sig = (sig << 16) | (sig >> (64 - 16))
	}
	ids = unique(ids)
	var docids []uint64
	for _, v := range ids {
		docids = append(docids, s.docids.find(v)...)
	}
	return docids
}
func ( s * Store ) Find ( sig uint64 ) [ ] uint64 { if len ( s . docids ) == 0 { return nil } var ids [ ] uint64 var t int for i := 0 ; i < 4 ; i ++ { p := sig ids = append ( ids , s . unshuffleList ( s . rhashes [ t ] . find ( p , mask3 , 3 ) , t ) ... ) t ++ p = ( sig & 0xffff000000ffffff ) | ( sig & 0x0000fff000000000 >> 12 ) | ( sig & 0x0000000fff000000 << 12 ) ids = append ( ids , s . unshuffleList ( s . rhashes [ t ] . find ( p , mask3 , 3 ) , t ) ... ) t ++ p = ( sig & 0xffff000fff000fff ) | ( sig & 0x0000fff000000000 >> 24 ) | ( sig & 0x0000000000fff000 << 24 ) ids = append ( ids , s . unshuffleList ( s . rhashes [ t ] . find ( p , mask3 , 3 ) , t ) ... ) t ++ p = ( sig & 0xffff000ffffff000 ) | ( sig & 0x0000fff000000000 >> 36 ) | ( sig & 0x0000000000000fff << 36 ) ids = append ( ids , s . unshuffleList ( s . rhashes [ t ] . find ( p , mask3 , 3 ) , t ) ... ) t ++ sig = ( sig << 16 ) | ( sig >> ( 64 - 16 ) ) } ids = unique ( ids ) var docids [ ] uint64 for _ , v := range ids { docids = append ( docids , s . docids . find ( v ) ... ) } return docids }
Find searches the store for all hashes hamming distance 3 or less from the
query signature.
Find searches the store for all hashes hamming distance 3 or less from the query signature .
// empty store // TODO(dgryski): search in parallel