/ Check-in [48505cde]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix the FTS5 xQueryPhrase() API function so that it recognizes column filters.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:48505cde05d74748454dc135d4ec25954ecf020e
User & Date: dan 2016-05-09 18:05:44
Context
2016-05-09
19:03
Update a comment in fts5.h. No changes to code. check-in: 14e53d0e user: dan tags: trunk
18:05
Fix the FTS5 xQueryPhrase() API function so that it recognizes column filters. check-in: 48505cde user: dan tags: trunk
2016-05-07
12:15
Make the sqlite3DeleteTable() routine smaller and faster. check-in: d75140b8 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to ext/fts5/fts5_expr.c.

  1650   1650     if( rc==SQLITE_OK ){
  1651   1651       pNew->pRoot = (Fts5ExprNode*)sqlite3Fts5MallocZero(&rc, 
  1652   1652           sizeof(Fts5ExprNode));
  1653   1653     }
  1654   1654     if( rc==SQLITE_OK ){
  1655   1655       pNew->pRoot->pNear = (Fts5ExprNearset*)sqlite3Fts5MallocZero(&rc, 
  1656   1656           sizeof(Fts5ExprNearset) + sizeof(Fts5ExprPhrase*));
         1657  +  }
         1658  +  if( rc==SQLITE_OK ){
         1659  +    Fts5Colset *pColsetOrig = pOrig->pNode->pNear->pColset;
         1660  +    if( pColsetOrig ){
         1661  +      int nByte = sizeof(Fts5Colset) + pColsetOrig->nCol * sizeof(int);
         1662  +      Fts5Colset *pColset = (Fts5Colset*)sqlite3Fts5MallocZero(&rc, nByte);
         1663  +      if( pColset ){ 
         1664  +        memcpy(pColset, pColsetOrig, nByte);
         1665  +      }
         1666  +      pNew->pRoot->pNear->pColset = pColset;
         1667  +    }
  1657   1668     }
  1658   1669   
  1659   1670     for(i=0; rc==SQLITE_OK && i<pOrig->nTerm; i++){
  1660   1671       int tflags = 0;
  1661   1672       Fts5ExprTerm *p;
  1662   1673       for(p=&pOrig->aTerm[i]; p && rc==SQLITE_OK; p=p->pSynonym){
  1663   1674         const char *zTerm = p->zTerm;

Changes to ext/fts5/test/fts5aux.test.

   241    241     execsql { DELETE FROM x1 }
   242    242     foreach row $lRow { execsql { INSERT INTO x1 VALUES($row) } }
   243    243     breakpoint
   244    244     do_execsql_test 8.$tn {
   245    245       SELECT highlight(x1, 0, '[', ']') FROM x1 WHERE x1 MATCH 'a OR (b AND d)';
   246    246     } $res
   247    247   }
          248  +
          249  +#-------------------------------------------------------------------------
          250  +# Test the built-in bm25() demo.
          251  +#
          252  +reset_db
          253  +do_execsql_test 9.1 {
          254  +  CREATE VIRTUAL TABLE t1 USING fts5(a, b);
          255  +  INSERT INTO t1 VALUES('a',   NULL);           -- 1
          256  +  INSERT INTO t1 VALUES('a',   NULL);           -- 2
          257  +  INSERT INTO t1 VALUES('a',   NULL);           -- 3
          258  +  INSERT INTO t1 VALUES('a',   NULL);           -- 4
          259  +  INSERT INTO t1 VALUES('a',   NULL);           -- 5
          260  +  INSERT INTO t1 VALUES('a',   NULL);           -- 6
          261  +  INSERT INTO t1 VALUES('a',   NULL);           -- 7
          262  +  INSERT INTO t1 VALUES('a',   NULL);           -- 8
          263  +  INSERT INTO t1 VALUES(NULL,  'a a b');        -- 9
          264  +  INSERT INTO t1 VALUES(NULL,  'b b a');        -- 10
          265  +}
          266  +
          267  +do_execsql_test 9.2 {
          268  +  SELECT rowid FROM t1('a AND b') ORDER BY rank;
          269  +} {
          270  +  10 9
          271  +}
          272  +
          273  +do_execsql_test 9.3 {
          274  +  SELECT rowid FROM t1('b:a AND b:b') ORDER BY rank;
          275  +} {
          276  +  9 10
          277  +}
          278  +
          279  +
   248    280   
   249    281   finish_test
   250    282