views:

93

answers:

1

I am wondering how would I be able to run a SQLite order by in this manner

select * from contacts order by jarowinkler(contacts.name,'john smith');

I know Android has a bottleneck with user defined functions, do I have an alternative?

+1  A: 

Step #1: Do the query minus the ORDER BY portion

Step #2: Create a CursorWrapper that wraps your Cursor, calculates the Jaro-Winkler distance for each position, sorts the positions, then uses the sorted positions when overriding all methods that require a position (e.g., moveToPosition(), moveToNext()).

CommonsWare
I am doing something similar in Java, but takes so much time while computes a N x M steps, script runs 2-3 minutes for 300 x 500.
Pentium10
I am unclear where the "N x M steps" comes from. If it is too slow to compute in Java, use the NDK.
CommonsWare
I am working on a person sync database, 1 end has N records, the other has M records, I run the jaro-winkler distance algorithm on their names to match the best.
Pentium10