rads / sqlite-okapi-bm25

📑 SQLite extension to add the Okapi BM25 ranking algorithm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong index in `x` info table

wqweto opened this issue · comments

Line 33
is currently int currentX = X_OFFSET + (3 * searchTextCol * (i + 1)); should become int currentX = X_OFFSET + (3 * (searchTextCol + i * colCount)); or similar.

Here is a sinppet from sqlite docs for matchinfo

          hits_this_row  = array[3 * (c + p*cols) + 0]
          hits_all_rows  = array[3 * (c + p*cols) + 1]
          docs_with_hits = array[3 * (c + p*cols) + 2]

where column idx c is searchTextCol, phrase idx p is i and number of cols cols is colCount

+1. currentX is calculated wrongly. It should be modified as wqweto are saying.