/ Check-in [46b2d3ce]
Login

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

Overview
Comment:Remove some dead code from fts3_snippet.c.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fts3-matchinfo-y
Files: files | file ages | folders
SHA1: 46b2d3cef5c22a9e6bd0a4f8411f17b7ec72bd18
User & Date: dan 2015-05-06 17:51:59
Context
2015-05-06
18:15
Merge latest trunk changes with this branch. check-in: 8a13e1fd user: dan tags: fts3-matchinfo-y
17:51
Remove some dead code from fts3_snippet.c. check-in: 46b2d3ce user: dan tags: fts3-matchinfo-y
17:41
More optimization for the 'y' and 'b' matchinfo directives. check-in: 8c5b9fed user: dan tags: fts3-matchinfo-y
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to ext/fts3/fts3_snippet.c.

   234    234   */
   235    235   static void fts3GetDeltaPosition(char **pp, int *piPos){
   236    236     int iVal;
   237    237     *pp += fts3GetVarint32(*pp, &iVal);
   238    238     *piPos += (iVal-2);
   239    239   }
   240    240   
   241         -static int fts3ExprLHitsCb(Fts3Expr*, int, void*);
   242         -
   243    241   /*
   244    242   ** Helper function for fts3ExprIterate() (see below).
   245    243   */
   246    244   static int fts3ExprIterate2(
   247    245     Fts3Expr *pExpr,                /* Expression to iterate phrases of */
   248    246     int *piPhrase,                  /* Pointer to phrase counter */
   249    247     int (*x)(Fts3Expr*,int,void*),  /* Callback function to invoke for phrases */
   250    248     void *pCtx                      /* Second argument to pass to callback */
   251    249   ){
   252    250     int rc;                         /* Return code */
   253         -
   254         -  if( x==fts3ExprLHitsCb && pExpr->bEof ){
   255         -    rc = SQLITE_OK;
   256         -  }else{
   257    251       int eType = pExpr->eType;     /* Type of expression node pExpr */
          252  +
   258    253       if( eType!=FTSQUERY_PHRASE ){
   259    254         assert( pExpr->pLeft && pExpr->pRight );
   260    255         rc = fts3ExprIterate2(pExpr->pLeft, piPhrase, x, pCtx);
   261    256         if( rc==SQLITE_OK && eType!=FTSQUERY_NOT ){
   262    257           rc = fts3ExprIterate2(pExpr->pRight, piPhrase, x, pCtx);
   263    258         }
   264    259       }else{
   265    260         rc = x(pExpr, *piPhrase, pCtx);
   266    261         (*piPhrase)++;
   267    262       }
   268         -  }
   269    263     return rc;
   270    264   }
   271    265   
   272    266   /*
   273    267   ** Iterate through all phrase nodes in an FTS3 query, except those that
   274    268   ** are part of a sub-tree that is the right-hand-side of a NOT operator.
   275    269   ** For each phrase node found, the supplied callback function is invoked.
................................................................................
   968    962       if( pCsr ){
   969    963         p->aMatchinfo[iStart+i*3] = fts3ColumnlistCount(&pCsr);
   970    964       }else{
   971    965         p->aMatchinfo[iStart+i*3] = 0;
   972    966       }
   973    967     }
   974    968   
   975         -  return rc;
   976         -}
   977         -
   978         -/*
   979         -** fts3ExprIterate() callback used to gather information for the matchinfo
   980         -** directives 'y' and 'b'.
   981         -*/
   982         -static int fts3ExprLHitsCb(
   983         -  Fts3Expr *pExpr,                /* Phrase expression node */
   984         -  int iPhrase,                    /* Phrase number */
   985         -  void *pCtx                      /* Pointer to MatchInfo structure */
   986         -){
   987         -  int rc = SQLITE_OK;
   988         -  MatchInfo *p = (MatchInfo *)pCtx;
   989         -  
   990         -  /* This must be a phrase */
   991         -  assert( pExpr->pPhrase );
   992         -
   993         -  if( pExpr->iDocid==p->pCursor->iPrevId ){
   994         -    Fts3Table *pTab = (Fts3Table *)p->pCursor->base.pVtab;
   995         -    int iStart;
   996         -    Fts3Phrase *pPhrase = pExpr->pPhrase;
   997         -    char *pIter = pPhrase->doclist.pList;
   998         -    int iCol = 0;
   999         -
  1000         -    assert( p->flag==FTS3_MATCHINFO_LHITS_BM || p->flag==FTS3_MATCHINFO_LHITS );
  1001         -    if( p->flag==FTS3_MATCHINFO_LHITS ){
  1002         -      iStart = iPhrase * p->nCol;
  1003         -    }else{
  1004         -      iStart = iPhrase * ((p->nCol + 31) / 32);
  1005         -    }
  1006         -
  1007         -    while( 1 ){
  1008         -      int nHit = fts3ColumnlistCount(&pIter);
  1009         -      if( (pPhrase->iColumn>=pTab->nColumn || pPhrase->iColumn==iCol) ){
  1010         -        if( p->flag==FTS3_MATCHINFO_LHITS ){
  1011         -          p->aMatchinfo[iStart + iCol] = (u32)nHit;
  1012         -        }else if( nHit ){
  1013         -          p->aMatchinfo[iStart + (iCol+1)/32] |= (1 << (iCol&0x1F));
  1014         -        }
  1015         -      }
  1016         -      assert( *pIter==0x00 || *pIter==0x01 );
  1017         -      if( *pIter!=0x01 ) break;
  1018         -      pIter++;
  1019         -      pIter += fts3GetVarint32(pIter, &iCol);
  1020         -    }
  1021         -  }
  1022         -
  1023    969     return rc;
  1024    970   }
  1025    971   
  1026    972   static int fts3MatchinfoCheck(
  1027    973     Fts3Table *pTab, 
  1028    974     char cArg,
  1029    975     char **pzErr