Hi Simon,
The ordering is not really the issue I am having. That, I can do if I just
get a result back that doesn't necessarily match all the keywords. In the
query you showed as an example, all the keywords would still have to match
in order for a row to be returned. The sorting is a separate problem that is
not really that difficult once I get a smaller dataset. Then I can order it
manually. The problem is that it only returns a match if every single word
is present. I would like it to return matches if, say, mor than 2 or 3 of
the specified keywords are found.
Kind regards,
Philip Bennefall
----- Original Message -----
From: "Simon Slavin" <[email protected]>
To: "General Discussion of SQLite Database" <[email protected]>
Sent: Thursday, June 14, 2012 8:24 PM
Subject: Re: [sqlite] Full text search without full phrase matches
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
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users