diff options
Diffstat (limited to 'ext/fts5')
-rw-r--r-- | ext/fts5/fts5.h | 2 | ||||
-rw-r--r-- | ext/fts5/fts5_aux.c | 2 | ||||
-rw-r--r-- | ext/fts5/fts5_hash.c | 22 | ||||
-rw-r--r-- | ext/fts5/test/fts5ae.test | 6 |
4 files changed, 5 insertions, 27 deletions
diff --git a/ext/fts5/fts5.h b/ext/fts5/fts5.h index 8e244f399..28be0de67 100644 --- a/ext/fts5/fts5.h +++ b/ext/fts5/fts5.h @@ -100,7 +100,7 @@ typedef void (*fts5_extension_function)( ** This API function is used to query the FTS table for phrase iPhrase ** of the current query. Specifically, a query equivalent to: ** -** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid DESC +** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid ** ** with $p set to a phrase equivalent to the phrase iPhrase of the ** current query is executed. For each row visited, the callback function diff --git a/ext/fts5/fts5_aux.c b/ext/fts5/fts5_aux.c index fbd786640..8e4beffe6 100644 --- a/ext/fts5/fts5_aux.c +++ b/ext/fts5/fts5_aux.c @@ -520,7 +520,7 @@ static void fts5Bm25Function( /* If no error has occurred, return the calculated score. Otherwise, ** throw an SQL exception. */ if( rc==SQLITE_OK ){ - sqlite3_result_double(pCtx, score); + sqlite3_result_double(pCtx, -1.0 * score); }else{ sqlite3_result_error_code(pCtx, rc); } diff --git a/ext/fts5/fts5_hash.c b/ext/fts5/fts5_hash.c index bd17205f1..69425a331 100644 --- a/ext/fts5/fts5_hash.c +++ b/ext/fts5/fts5_hash.c @@ -70,28 +70,6 @@ struct Fts5HashEntry { }; /* -** Format value iVal as a 4-byte varint and write it to buffer a[]. 4 bytes -** are used even if the value could fit in a smaller amount of space. -*/ -static void fts5Put4ByteVarint(u8 *a, int iVal){ - a[0] = (0x80 | (u8)(iVal >> 21)); - a[1] = (0x80 | (u8)(iVal >> 14)); - a[2] = (0x80 | (u8)(iVal >> 7)); - a[3] = (0x7F & (u8)(iVal)); -} - -static int fts5Get4ByteVarint(u8 *a, int *pnVarint){ - int iRet = ((int)(a[0] & 0x7F) << 21) + ((int)(a[1] & 0x7F) << 14) - + ((int)(a[2] & 0x7F) << 7) + ((int)(a[3])); - *pnVarint = ( - (iRet & 0xFFFFFF80)==0 ? 1 : - (iRet & 0xFFFFC000)==0 ? 2 : - (iRet & 0xFFE00000)==0 ? 3 : 4 - ); - return iRet; -} - -/* ** Allocate a new hash table. */ int sqlite3Fts5HashNew(Fts5Hash **ppNew, int *pnByte){ diff --git a/ext/fts5/test/fts5ae.test b/ext/fts5/test/fts5ae.test index c9c3fcce3..d310e723b 100644 --- a/ext/fts5/test/fts5ae.test +++ b/ext/fts5/test/fts5ae.test @@ -265,15 +265,15 @@ foreach {tn q res} { 6 {j AND (h OR i)} {5 6} } { do_execsql_test 8.2.$tn.1 { - SELECT rowid FROM t8 WHERE t8 MATCH $q ORDER BY bm25(t8) DESC; + SELECT rowid FROM t8 WHERE t8 MATCH $q ORDER BY bm25(t8); } $res do_execsql_test 8.2.$tn.2 { - SELECT rowid FROM t8 WHERE t8 MATCH $q ORDER BY +rank DESC; + SELECT rowid FROM t8 WHERE t8 MATCH $q ORDER BY +rank; } $res do_execsql_test 8.2.$tn.3 { - SELECT rowid FROM t8 WHERE t8 MATCH $q ORDER BY rank DESC; + SELECT rowid FROM t8 WHERE t8 MATCH $q ORDER BY rank; } $res } |