@@ -24,6 +24,7 @@ extern "C" {
24
24
#include " sleep.h"
25
25
#include " str.h"
26
26
#include " time-util.h"
27
+ #include " unichar.h"
27
28
#include " fts-backend-flatcurve.h"
28
29
#include " fts-backend-flatcurve-xapian.h"
29
30
#include < dirent.h>
@@ -1247,7 +1248,7 @@ fts_flatcurve_xapian_index_header(struct flatcurve_fts_backend_update_context *c
1247
1248
{
1248
1249
struct fts_flatcurve_user *fuser = ctx->backend ->fuser ;
1249
1250
std::string h;
1250
- Xapian::Utf8Iterator ustr ;
1251
+ const char *p = ( const char *)data ;
1251
1252
struct flatcurve_xapian *x = ctx->backend ->xapian ;
1252
1253
1253
1254
if (!fts_flatcurve_xapian_init_msg (ctx))
@@ -1259,12 +1260,11 @@ fts_flatcurve_xapian_index_header(struct flatcurve_fts_backend_update_context *c
1259
1260
FLATCURVE_XAPIAN_BOOLEAN_FIELD_PREFIX + h);
1260
1261
}
1261
1262
1262
- ustr = Xapian::Utf8Iterator ((const char *)data, size);
1263
1263
if (ctx->indexed_hdr )
1264
1264
h = str_ucase (str_c_modifiable (ctx->hdr_name ));
1265
1265
1266
1266
do {
1267
- std::string t (ustr. raw () );
1267
+ std::string t (p, size );
1268
1268
1269
1269
/* Capital ASCII letters at the beginning of a Xapian term are
1270
1270
* treated as a "term prefix". Check for a leading ASCII
@@ -1278,25 +1278,28 @@ fts_flatcurve_xapian_index_header(struct flatcurve_fts_backend_update_context *c
1278
1278
FLATCURVE_XAPIAN_HEADER_PREFIX + h + t);
1279
1279
}
1280
1280
x->doc ->add_term (FLATCURVE_XAPIAN_ALL_HEADERS_PREFIX + t);
1281
+
1282
+ unsigned int csize = uni_utf8_char_bytes (*p);
1283
+ p += csize;
1284
+ size -= csize;
1281
1285
} while (fuser->set .substring_search &&
1282
- ((++ustr).left () >= fuser->set .min_term_size ));
1286
+ (size >= 0 ) &&
1287
+ (uni_utf8_strlen (p) >= fuser->set .min_term_size ));
1283
1288
}
1284
1289
1285
1290
void
1286
1291
fts_flatcurve_xapian_index_body (struct flatcurve_fts_backend_update_context *ctx,
1287
1292
const unsigned char *data, size_t size)
1288
1293
{
1289
1294
struct fts_flatcurve_user *fuser = ctx->backend ->fuser ;
1290
- Xapian::Utf8Iterator ustr ;
1295
+ const char *p = ( const char *)data ;
1291
1296
struct flatcurve_xapian *x = ctx->backend ->xapian ;
1292
1297
1293
1298
if (!fts_flatcurve_xapian_init_msg (ctx))
1294
1299
return ;
1295
1300
1296
- ustr = Xapian::Utf8Iterator ((const char *)data, size);
1297
-
1298
1301
do {
1299
- std::string t (ustr. raw () );
1302
+ std::string t (p, size );
1300
1303
1301
1304
/* Capital ASCII letters at the beginning of a Xapian term are
1302
1305
* treated as a "term prefix". Check for a leading ASCII
@@ -1306,8 +1309,13 @@ fts_flatcurve_xapian_index_body(struct flatcurve_fts_backend_update_context *ctx
1306
1309
t[0 ] = i_tolower (t[0 ]);
1307
1310
1308
1311
x->doc ->add_term (t);
1312
+
1313
+ unsigned int csize = uni_utf8_char_bytes (*p);
1314
+ p += csize;
1315
+ size -= csize;
1309
1316
} while (fuser->set .substring_search &&
1310
- ((++ustr).left () >= fuser->set .min_term_size ));
1317
+ (size >= 0 ) &&
1318
+ (uni_utf8_strlen (p) >= fuser->set .min_term_size ));
1311
1319
}
1312
1320
1313
1321
void fts_flatcurve_xapian_delete_index (struct flatcurve_fts_backend *backend)
0 commit comments