Hi, Thank you for your reply. By exact, I mean "this is a test case" should only be returned as a match if the search term is "this is a test case" and not "test case" or "this is a" or anything such like. I added a simple AND clause as per your suggestion and it seems to work great. It's still very fast, which means it must be doing the '=' comparison after the result has been confirmed from the FTS.
Thank you! Thanks Ray Scott Hess wrote: > > On Mon, Jun 29, 2009 at 8:52 AM, Raeldor<ray.pr...@gartner.com> wrote: >> Does anyone know if there is a syntax in FTS3 to perform an exact match? >> I >> couldn't see any examples in the sqlite documentation for this, but I >> think >> there are some operators (*) that are not covered in that documentation. > > Not sure what you mean by "exact match". "SELECT docid FROM fts_table > WHERE col MATCH 'string'" will return docids for rows which contain > 'string'. It's not "exact" in the sense that by default matching is > case-insensitive. > > If you need to find "eXact", then fts can't do it directly, but you > could do post-processing. Maybe "SELECT docid, col FROM fts_table > WHERE col MATCH 'eXact' HAVING col LIKE '%eXact%'". That would also > match cases where "exact" is present as a word and "eXact" is a > substring of a larger string. My syntax might be wrong, but the > overall picture should be something like that. Also, you could of > course use AND instead of HAVING (I used HAVING mainly because I want > the fts index for finding the possibilities then the expression to > filter them). > > -scott > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > -- View this message in context: http://www.nabble.com/Exact-Match-Syntax-with-FTS3--tp24256776p24257664.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users