Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | When extracting search text from tickets, use the title column for the title and pay attention to mimetypes when translating. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | search-enhancements |
| Files: | files | file ages | folders |
| SHA1: |
b552f55b1f584056aeff3872a80b22f9 |
| User & Date: | drh 2015-02-13 22:03:02.792 |
Context
|
2015-02-13
| ||
| 23:43 | Show document, ticket, and wiki titles on the result page of unindexed search. check-in: 0e77f1fbc0 user: drh tags: search-enhancements | |
| 22:03 | When extracting search text from tickets, use the title column for the title and pay attention to mimetypes when translating. check-in: b552f55b1f user: drh tags: search-enhancements | |
| 21:21 | Merge enhancements and fixes from trunk. check-in: 23c86b503f user: drh tags: search-enhancements | |
Changes
Changes to src/search.c.
| ︙ | ︙ | |||
1032 1033 1034 1035 1036 1037 1038 | blob_reset(&title); } /* ** Query pQuery is pointing at a single row of output. Append a text ** representation of every text-compatible column to pAccum. */ | | > > > > > > > > > > > | | < < > | | > > > > > > > | 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 |
blob_reset(&title);
}
/*
** Query pQuery is pointing at a single row of output. Append a text
** representation of every text-compatible column to pAccum.
*/
static void append_all_ticket_fields(Blob *pAccum, Stmt *pQuery, int iTitle){
int n = db_column_count(pQuery);
int i;
const char *zMime = 0;
if( iTitle>=0 ){
if( db_column_type(pQuery,iTitle)==SQLITE_TEXT ){
blob_append(pAccum, db_column_text(pQuery,iTitle), -1);
}
blob_append(pAccum, "\n", 1);
}
for(i=0; i<n; i++){
const char *zColName = db_column_name(pQuery,i);
int eType = db_column_type(pQuery,i);
if( i==iTitle ) continue;
if( fossil_strnicmp(zColName,"tkt_",4)==0 ) continue;
if( fossil_strnicmp(zColName,"private_",8)==0 ) continue;
if( eType==SQLITE_BLOB || eType==SQLITE_NULL ) continue;
if( fossil_stricmp(zColName,"mimetype")==0 ){
zMime = db_column_text(pQuery,i);
if( fossil_strcmp(zMime,"text/plain")==0 ) zMime = 0;
}else if( zMime==0 || eType!=SQLITE_TEXT ){
blob_appendf(pAccum, "%s: %s |\n", zColName, db_column_text(pQuery,i));
}else{
Blob txt;
blob_init(&txt, db_column_text(pQuery,i), -1);
blob_appendf(pAccum, "%s: ", zColName);
get_stext_by_mimetype(&txt, zMime, pAccum);
blob_append(pAccum, " |", 2);
blob_reset(&txt);
}
}
}
/*
** Return "search text" - a reduced version of a document appropriate for
|
| ︙ | ︙ | |||
1124 1125 1126 1127 1128 1129 1130 |
}
}
db_reset(&q);
break;
}
case 't': { /* Tickets */
static Stmt q1;
| | < > > > > > > | | < < | 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 |
}
}
db_reset(&q);
break;
}
case 't': { /* Tickets */
static Stmt q1;
static int iTitle = -1;
db_static_prepare(&q1, "SELECT * FROM ticket WHERE tkt_id=:rid");
db_bind_int(&q1, ":rid", rid);
if( db_step(&q1)==SQLITE_ROW ){
if( iTitle<0 ){
int n = db_column_count(&q1);
for(iTitle=0; iTitle<n; iTitle++){
if( fossil_stricmp(db_column_name(&q1,iTitle),"title")==0 ) break;
}
}
append_all_ticket_fields(pOut, &q1, iTitle);
}
db_reset(&q1);
if( db_table_exists("repository","ticketchng") ){
static Stmt q2;
db_static_prepare(&q2, "SELECT * FROM ticketchng WHERE tkt_id=:rid"
" ORDER BY tkt_mtime");
db_bind_int(&q2, ":rid", rid);
while( db_step(&q2)==SQLITE_ROW ){
append_all_ticket_fields(pOut, &q2, -1);
}
db_reset(&q2);
}
break;
}
}
}
/*
** COMMAND: test-search-stext
|
| ︙ | ︙ |