Re: [sqlite] FTS Find Tokens at Record Start

2013-04-05 Thread Fabian Klebert
You might want to check the following:

SELECT word FROM fts WHERE fts MATCH '^token'

Beginning with 3.7.9 this should only return records that have 'token' at the 
beginning of the record.
See changelog of 3.7.9:

If a search token (on the right-hand side of the MATCH operator) in FTS4 begins 
with "^" then that token must be the first in its field of the document. ** 
Potentially Incompatible Change **



-Ursprüngliche Nachricht-
Von: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
Im Auftrag von Clemens Ladisch
Gesendet: Freitag, 5. April 2013 15:41
An: sqlite-users@sqlite.org
Betreff: Re: [sqlite] FTS Find Tokens at Record Start

Paul Vercellotti wrote:
> using FTS, how do you match records that contain certain tokens beginning at 
> the start of the record

Apparently, this information is not stored in the FTS index.

Search for the tokens, then manually check with LIKE or something like that.


Regards,
Clemens
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] FTS Find Tokens at Record Start

2013-04-05 Thread Clemens Ladisch
Paul Vercellotti wrote:
> using FTS, how do you match records that contain certain tokens beginning at 
> the start of the record

Apparently, this information is not stored in the FTS index.

Search for the tokens, then manually check with LIKE or something like that.


Regards,
Clemens
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] FTS Find Tokens at Record Start

2013-04-04 Thread Paul Vercellotti


Hi there,

I couldn't find this from the documentation: using FTS, how do you match 
records that contain certain tokens beginning at the start of the record (or 
any token position for that matter).

For example, I want to match records that start with "Four score and seven 
years ago" but not match records that contain that phrase in the middle.

This matches any document that contains the phrase:
SELECT rowid FROM documents WHERE content MATCH '"Four score and seven years 
ago"';
But I want only the results that start with that phrase, which would be a 
subset of those results. 

It looks like I could programmatically parse the output of the offsetsfunction 
to find this info and manually filter my results, but is there a way to set up 
the query so it does the filtering for me, and only returns results that start 
at byte offset 0 in the column (or token 0)?


Thanks!
-Paul
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users