On 14 Jun 2012, at 7:13pm, Philip Bennefall <[email protected]> wrote:

> That is unfortunate, if it is true that there's no way to accomplish this 
> with SqLite. To do just plain matching I can use an unordered hash map, so I 
> wouldn't need a database for that. The trouble with a string distance 
> function is that I can't really process the entire dataset with it. SqLite 
> technically has all the features I'm after, I just don't want it to 
> necessarily match all the words in a query. If I can get it to match all as 
> well as some, that would be enough. I could then do distancing on a 
> considerably smaller dataset which would be the result of the broader SqLite 
> search.
> 
> So I guess my main question is, is there absolutely no way to match a subset 
> of the words in a query?

Well, you could write that string distance function and add it to your copy of 
SQLite as an external function.  Then you could do things like

SELECT string_distance(theText, 'this new piece of text'), theText FROM 
oldChats WHERE string_distance(theText, 'this new piece of text') < 10 ORDER BY 
string_distance(theText, 'this new piece of text')

(I don't know whether SQLite will optimise that to avoid executing the same 
function many times, or whether you can name a column and use that name to do 
the same thing yourself.)

Here's the documentation for external functions:

<http://www.sqlite.org/c3ref/create_function.html>

Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to