Implement a custom vector similarity search index structure from scratch using basic math libraries.
Build a sign-based locality-sensitive hashing index from supplied hyperplanes, then rerank candidates by cosine similarity. Implement vector_similarity_search(vectors, queries, hyperplanes, k, max_hamming_distance) and return one list of vector indices per query, ordered by descending similarity and then ascending index. Use only Python's standard library.
def vector_similarity_search(vectors, queries, hyperplanes, k, max_hamming_distance):