Happy New Year to all list members.

The following affirms my understandings.  Thank you, kind sir.

The balance of my original query to the list was spurred solely by my
ignorance (and coding when I should have been sleeping... ;-).  Further
testing has revealed that the behavior of the snippet functionality is just
as Dan had described it:  "The snippet() function is returning two fragments
of text (since it cannot find a single fragment that contains all the terms
in your query).".

Given Snippet Construct: snippet(FTS_Table, ' ', ' ', '...', -3, -10)

The negative values in the snippet's construct is what was causing me to see
the content from the other (unintended by me) fields.  This was further
confused/obscured as I was desiring to not have mid-snippet token highlights
in my app (i.e. I wanted only the starting/ending '...'), so the single
tokens from the other fields were wrapped by spaces.

In the end, I have the tool functioning exactly as desired.  FTS is a very
nice feature, indeed.!.

Thanks to all who responded.  It is much appreciated.  I bid each and every
one of you a joyful and prosperous 2011!  Take care and be safe.

-t

-----Original Message-----
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Richard Hipp
Sent: Friday, December 31, 2010 09:43 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] FTS4 snippets contains unintended content?

On Fri, Dec 31, 2010 at 8:47 AM, Black, Michael (IS) <michael.bla...@ngc.com
> wrote:

> (I have to remember to take of this stupid EXTERNAL thing my emailer puts
> on all outside emails...)
>
> Actually, this is the way I understand it right now...
>
> Construct: MATCH 'bug report API_Version:374 OR API_Version:UAR'
>
> Verbose: Perform an FTS search on the order-independent AND'd words 'bug
> report API Version 376' OR 'API Version UAR', and return only
> records that contain either grouping.
>

This is true if and only if you compiled using
SQLITE_ENABLE_FTS3_PARENTHESIS.  The legacy behavior (and the behavior
matching popular search engines) that is used when the above compile-time
option is omitted is that OR has higher precedence than AND.  Hence, the
query is equivalent to:

      MATCH 'bug report (api_version:374 OR api_version:uar)'

Note that the example above is notional only.  Parentheses cannot be used
for grouping in the legacy query syntax.  But if you do define the
SQLITE_ENABLE_FTS3_PARENTHESIS compile-time option, then AND gets higher
precedence than OR and the query becomes:

     MATCH '(bug report api_version:374) OR (api_version:uar)'

In both cases, the "api_version:" prefix on "374" and "uar" means that the
tokens "374" and "uar" much appear in the "api_version" column of the FTS
table.


>
> Let's confirm adding on to our last example...
>
> sqlite> insert into data values('UAR report bug 374 API_Version');
> sqlite> select * from data where content match  'bug report
API_Version:374
> OR API_Version:UAR';
> we got bug report API_Version:374 is right here
> we got API_Version:UAR right here
> UAR report bug 374 API_Version
>
> There's no order dependence at all...
>
> Quotes around the 2nd phrase makes no difference.
> sqlite> select * from data where content match  'bug report
API_Version:374
> OR "API_Version:UAR"';
> we got bug report API_Version:374 is right here
> we got API_Version:UAR right here
> UAR report bug 374 API_Version
>
> Quotes around the 1st phrase does make a difference:
> sqlite> select * from data where content match  '"bug report
> API_Version:374" OR "API_Version:UAR"';
> we got bug report API_Version:374 is right here
> we got API_Version:UAR right here
>
> So I'm completely confused as to what quotes do here...
>
>
> Michael D. Black
> Senior Scientist
> Advanced Analytics Directorate
> Northrop Grumman Information Systems
>
>
> ________________________________
>
> From: sqlite-users-boun...@sqlite.org on behalf of Tod Wulff
> Sent: Wed 12/29/2010 12:06 PM
> To: 'General Discussion of SQLite Database'
> Subject: EXTERNAL:Re: [sqlite] FTS4 snippets contains unintended content?
>
>
>
> Good day, Michael.  Thank you for taking the time to respond.
>
> Per my (possibly ignorant) understanding of the FTS docs, this construct
> can
> be described as such:
>
> Construct: MATCH 'bug report API_Version:374 OR API_Version:UAR'
>
> Verbose: Perform an FTS search on the phrase 'bug report', and return only
> records that contain '374' or 'UAR' in the API_Version column.
>
>
>
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>


-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
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

Reply via email to