Fossil

Diff
Login

Differences From Artifact [cbfa399bdc]:

To Artifact [2b74f1844c]:


850
851
852
853
854
855
856

857
858
859
860
861
862
863
864
  const char *zPattern,       /* The query pattern */
  unsigned int srchFlags      /* What to search over */
){
  search_init(zPattern, "<mark>", "</mark>", " ... ",
          SRCHFLG_STATIC|SRCHFLG_HTML);
  if( (srchFlags & SRCH_DOC)!=0 ){
    char *zDocGlob = db_get("doc-glob","");

    char *zDocBr = db_get("doc-branch","trunk");
    if( zDocGlob && zDocGlob[0] && zDocBr && zDocBr[0] ){
      Glob * pGlob = glob_create(zDocBr)
        /* We're misusing a Glob as a list of comma-/space-delimited
        ** tokens. We're not actually doing glob matches here. */;
      int i;
      db_multi_exec(
        "CREATE VIRTUAL TABLE IF NOT EXISTS temp.foci USING files_of_checkin;"







>
|







850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
  const char *zPattern,       /* The query pattern */
  unsigned int srchFlags      /* What to search over */
){
  search_init(zPattern, "<mark>", "</mark>", " ... ",
          SRCHFLG_STATIC|SRCHFLG_HTML);
  if( (srchFlags & SRCH_DOC)!=0 ){
    char *zDocGlob = db_get("doc-glob","");
    char *zMainBranch = db_get("main-branch", 0);
    char *zDocBr = db_get("doc-branch", zMainBranch);
    if( zDocGlob && zDocGlob[0] && zDocBr && zDocBr[0] ){
      Glob * pGlob = glob_create(zDocBr)
        /* We're misusing a Glob as a list of comma-/space-delimited
        ** tokens. We're not actually doing glob matches here. */;
      int i;
      db_multi_exec(
        "CREATE VIRTUAL TABLE IF NOT EXISTS temp.foci USING files_of_checkin;"
881
882
883
884
885
886
887

888
889
890
891
892
893
894
          "                      body('d',blob.rid,foci.filename))"
          "     AND %z",
          zBranch, zBranch, zBranch, glob_expr("foci.filename", zDocGlob)
        );
      }
      glob_free(pGlob);
    }

    fossil_free(zDocGlob);
    fossil_free(zDocBr);
  }
  if( (srchFlags & SRCH_WIKI)!=0 ){
    db_multi_exec(
      "WITH wiki(name,rid,mtime) AS ("
      "  SELECT substr(tagname,6), tagxref.rid, max(tagxref.mtime)"







>







882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
          "                      body('d',blob.rid,foci.filename))"
          "     AND %z",
          zBranch, zBranch, zBranch, glob_expr("foci.filename", zDocGlob)
        );
      }
      glob_free(pGlob);
    }
    fossil_free(zMainBranch);
    fossil_free(zDocGlob);
    fossil_free(zDocBr);
  }
  if( (srchFlags & SRCH_WIKI)!=0 ){
    db_multi_exec(
      "WITH wiki(name,rid,mtime) AS ("
      "  SELECT substr(tagname,6), tagxref.rid, max(tagxref.mtime)"
1984
1985
1986
1987
1988
1989
1990

1991
1992
1993
1994
1995
1996
1997
1998
/*
** If the doc-glob and doc-br settings are valid for document search
** and if the latest check-in on doc-br is in the unindexed set of
** check-ins, then update all 'd' entries in FTSDOCS that have
** changed.
*/
static void search_update_doc_index(void){

  const char *zDocBranches = db_get("doc-branch","trunk");
  int i;
  Glob * pGlob = glob_create(zDocBranches)
    /* We're misusing a Glob as a list of comma-/space-delimited
    ** tokens. We're not actually doing glob matches here. */;
  if( !pGlob ) return;
  db_multi_exec(
    "CREATE TEMP TABLE current_docs(rid INTEGER PRIMARY KEY, name);"







>
|







1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
/*
** If the doc-glob and doc-br settings are valid for document search
** and if the latest check-in on doc-br is in the unindexed set of
** check-ins, then update all 'd' entries in FTSDOCS that have
** changed.
*/
static void search_update_doc_index(void){
  char *zMainBranch = db_get("main-branch", 0);
  const char *zDocBranches = db_get("doc-branch", zMainBranch);
  int i;
  Glob * pGlob = glob_create(zDocBranches)
    /* We're misusing a Glob as a list of comma-/space-delimited
    ** tokens. We're not actually doing glob matches here. */;
  if( !pGlob ) return;
  db_multi_exec(
    "CREATE TEMP TABLE current_docs(rid INTEGER PRIMARY KEY, name);"
2041
2042
2043
2044
2045
2046
2047

2048
2049
2050
2051
2052
2053
2054
      "UPDATE ftsdocs SET"
      "  idxed=1,"
      "  bx=NULL,"
      "  label='Document: '||label"
      " WHERE type='d' AND NOT idxed"
    );
  }

  glob_free(pGlob);
}

/*
** Deal with all of the unindexed 'c' terms in FTSDOCS
*/
static void search_update_checkin_index(void){







>







2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
      "UPDATE ftsdocs SET"
      "  idxed=1,"
      "  bx=NULL,"
      "  label='Document: '||label"
      " WHERE type='d' AND NOT idxed"
    );
  }
  fossil_free(zMainBranch);
  glob_free(pGlob);
}

/*
** Deal with all of the unindexed 'c' terms in FTSDOCS
*/
static void search_update_checkin_index(void){