So, can anyone provide a working example of how this can work? Or, look 
at the code I have to figure out what I have wrong?  I'm still not 
getting anything to work.

To recap:

    Overall, I'd like to be able to set up 2 *sqlite3* FTS databases.
    One that holds quotes, with ranked search output, as the above
    example is trying to do.

    The other one is to hold entire books, with some minimal structure,
    like 'Book / Volume or Section / Chapter / text' so that I could do
    a query to show a list of all the books in the db, then when one is
    selected, it would show all chapters in a clickable list on the left
    side of a web page, with the text from a selected chapter on the
    right.  Or be able to search, and have the results ranked, with the
    output like this:

    book / Chapter:
         Hit 1's paragraph text
    Book / Chapter:
         Hit 2's paragraph text

    I want the search results to be limited to either a specific
    chapter, a specific book, or over the entire database, via select
    boxes in the book/chapter list displayed on the left of a web page. 

Any help with the database side of this would be greatly appreciated.


-------- Original Message --------
Subject: Re: [sqlite] FTS4 code from the website
From: Dan Kennedy <>
Date: 7/1/2011 7:33 AM
> On 06/30/2011 08:55 PM, Ryan Henrie wrote:
>> Even if I use the stock example from the web page, with only 2 columns,
>> and the exact schema from the example, I get the same result.
>> I'm wondering if it is a bug in the example code on the website (ie the
>> source code has moved on, invalidating an example based on old code), or
>> it's just something in turning their c code example into a full
>> extension that I didn't do right.
>>    From the extension's source code:
>>      nCol = aMatchinfo[1];
>>      if( nVal!=(*1+nCol*) ) goto wrong_number_args;
>> So, it should scale with the number of columns.  (I would hope it's not
>> hardcoded to a set number of columns!)
> The page is a bit deceptive. The key phrase relating to the C code
> example is:
>     "Instead of a single weight, it allows a weight to be externally
>      assigned to each column of each document."
> Making the C code function incompatible with the SQL example above
> it. The C code function would work with the example in its header
> comment:
>       CREATE VIRTUAL TABLE documents USING fts3(title, content);
>       SELECT docid FROM documents
>       WHERE documents MATCH<query>
>       ORDER BY rank(matchinfo(documents), 1.0, 0.5) DESC;
> It wouldn't be real hard to adapt the C code so that it accepted
> a single weight argument like the hypothetical function in the
> SQL example above it.
sqlite-users mailing list

Reply via email to