On Tue, Jun 8, 2010 at 8:29 AM, Jay A. Kreibich <j...@kreibi.ch> wrote:
> On Tue, Jun 08, 2010 at 06:56:33AM -0500, P Kishor scratched on the wall:
>> Hi all, re-asking this in case it missed some of the keener eyes -- I
>> am using the Snippet() function to return a snippet of text from my
>> FTS3 table showing the MATCH context. I would like to make the
>> returned snippet longer. Is that possible?
>
>  Yes.     http://sqlite.org/fts3.html#section_4_2
>
>


Yup, I read that, and I just can't get it. Per the docs

"The snippet function is used to create formatted fragments of
document text for display as part of a full-text query results report.
The snippet function may be passed between one and four arguments, as
follows:

Argument        Default Value   Description
0       N/A      The first argument to the snippet function must always be the
special hidden column of the FTS3 table that takes the same name as
the table itself.
1       "<b>"    The "start match" text.
2       "</b>"   The "end match" text.
3       "<b>...</b>"     The "ellipses" text.
4       -1       The FTS3 table column number to extract the returned fragments
of text from. Columns are numbered from left to right starting with
zero. A negative value indicates that the text may be extracted from
any column.
5       -15      The absolute value of this integer argument is used as the
(approximate) number of tokens to include in the returned text value.
The maximum allowable absolute value is 64. The value of this argument
is refered to as N in the discussion below."

So, first of all, the docs say that Snippet function takes between one
and four arguments, and then it lists 6 possible arguments. From what
I read above, it is the sixth argument, that is, argument 5, where I
can specify the "approximate" number of tokens in the returned text
value. First, what the heck does '-15' mean? Second, specifying
anything more than 4 arguments gives me a SQLite error. For example,

Snippet(fts_pages, '<span class="hilite">', '</span>', '', -1, 64) AS context

gives the following error

wrong number of arguments to function snippet() at
/Users/punkish/Sites/punkish/_perl/Punkish.pm line 535, <FH> line 36.,
referer: http://punkish.local/
[Tue Jun 08 08:44:54 2010] [error] [client 127.0.0.1] perl(3344)
malloc: *** error for object 0x100b7dc00: pointer being freed was not
allocated, referer: http://punkish.local/
[Tue Jun 08 08:44:54 2010] [error] [client 127.0.0.1] *** set a
breakpoint in malloc_error_break to debug,


What am I missing?



-- 
Puneet Kishor http://www.punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
-----------------------------------------------------------------------
Assertions are politics; backing up assertions with evidence is science
=======================================================================
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to