@Override
    public void search(K q, double radius, List<Neighbor<K, V>> neighbors) {
        if (radius <= 0 || radius != (int) radius) {
            throw new IllegalArgumentException("The parameter radius has to be an integer: " + radius);
        }

        long fpq = simhash.hash(q);
        Set<Integer> candidates = getCandidates(q);
        for (int index : candidates) {
            int distance = HammingDistance.d(fpq, signatures.get(index));
            if (distance <= radius) {
                neighbors.add(new Neighbor<>(keys.get(index), data.get(index), index, distance));
            }
        }
    }
@Test
    public void test() throws IOException {
        System.out.println("SNLSH");

        SNLSH<String[], String> lsh = createLSH(texts);

        ArrayList<Neighbor<String[], String>> neighbors = new ArrayList<>();
        lsh.search(tokenize(texts[0]), 3, neighbors);
        assertEquals(2, neighbors.size());
        assertEquals(0, neighbors.get(0).index);
        assertEquals(1, neighbors.get(1).index);

        neighbors.clear();
        lsh.search(tokenize(texts[1]), 3, neighbors);
        assertEquals(2, neighbors.size());
        assertEquals(0, neighbors.get(0).index);
        assertEquals(1, neighbors.get(1).index);

        neighbors.clear();
        lsh.search(tokenize(texts[2]), 3, neighbors);
        assertEquals(1, neighbors.size());
        assertEquals(2, neighbors.get(0).index);

        neighbors.clear();
        lsh.search(tokenize(texts[3]), 3, neighbors);
        assertEquals(1, neighbors.size());
        assertEquals(3, neighbors.get(0).index);
    }