How to store data with an approximate query?

I am trying to find a way to store my data with quick access (better than O (n)).

My database consists of data (4096 byte lines) that represent some information about some elements.
The problem is that a query is never accurate. I get one element, and then I need to find the closest match using the function F(a,b).

just an example:

1234
3456
6466
F(a,b) = return % of similar digits  

GetClosest(1233,F) = 1234

The problem is that F (a, b) is a complex algorithm (not a proper metric).

What I have is just to browse the entire database to find the best fit.
Is there a kind of tree or other type of cluster database that can speed up the search?

Additional Information:

F %. 100% .

+3
2

, ", ", - , . 4096 .

, , , , , , , . , , , .

, , ? , . , . , ( ) .

+1

, "" .

/ .

.

"", .

0

All Articles