Correction: my code functions as described in the documentation, but not as
it is described in the comments of the example code.

The example code comments state that the weight is determined by every
column whereas the example given above the code states that the weight as
determined by the row.

example mentioned in documentation:

    rank(matchinfo(documents), documents_data.weight);

code comment use case:

    rank(matchinfo(documents), <col1_weight>, <doc.col2>, ...);


The comment in the code makes more sense then the example for common use
cases (title vs body rather than one row vs another), however, in the case
that a column isn't supplied it makes sense to use a default weight of 1.0
if the weights aren't supplied.

AJ ONeal

On Sat, Jul 21, 2012 at 5:27 PM, AJ ONeal <coola...@gmail.com> wrote:

> I also found an error in the signedness of ints (using -Wall -Werror).
>
> The corrected code here functions as described in the documentation's
> example:
> https://github.com/coolaj86/sqlite3-fts4-rank/blob/master/fts4-rank.c#L59
>
> AJ ONeal
>
>
> On Sat, Jul 21, 2012 at 4:39 PM, AJ ONeal <coola...@gmail.com> wrote:
>
>> Back to looking at http://www.sqlite.org/fts3.html#appendix_a
>>
>> Notice the line:
>>
>>     if( nVal!=(1+nCol) ) goto wrong_number_args;
>>
>> nVal will always be 2 with the given use case:
>>
>>     rank(matchinfo(documents), documents_data.weight)
>>
>> or in the previous use case it will be 1
>>
>>     rank(matchinfo(documents))
>>
>> Seems that it would be best to assign a default weight of 1 if nVal == 1
>> or the double value of apVal[1] otherwise.
>>
>> Also the line
>>
>>     double weight = sqlite3_value_double(apVal[iCol+1]);
>>
>> should be simplified to:
>>
>>     double weight = sqlite3_value_double(apVal[1]);
>>
>> AJ ONeal
>>
>
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to