On 07/22/2012 05:39 AM, AJ ONeal 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
Ranking of search results is a tough problem. Different people have
different ideas as to how it should be done. So FTS supplies the
matchinfo() primitive to allow people to build their own ranking
functions.
So Appendix A of that document is supposed to be a kind of tutorial
that walks you through your options, in increasing order of complexity,
for building a ranking function. The different blocks of example
code are not meant to work together.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users