1
0
Fork 0

mini changes

This commit is contained in:
Jan Steemann 2012-12-06 13:12:49 +01:00
parent 242a16d6f5
commit b8fc158e77
3 changed files with 6 additions and 37 deletions

View File

@ -227,7 +227,7 @@ static void RealAddDocument (FTS_index_t* ftx, FTS_document_id_t docid) {
x3zstr = ZStrCons(35);
x3zstrb = ZStrCons(35);
for (i = 0; i< nowords; i++) {
for (i = 0; i < nowords; i++) {
uint64_t unicode;
uint8_t* utf;
@ -636,7 +636,7 @@ static uint64_t FindKKey2 (FTS_real_index* ix, uint64_t* word) {
uint64_t bkey;
tran = *(word++);
if (tran==0) {
if (tran == 0) {
break;
}
// get the Z-string for the index-2 entry of this key
@ -1264,7 +1264,7 @@ FTS_document_ids_t* FTS_FindDocuments (FTS_index_t* ftx,
lasthan = newhan;
ndocs++;
}
if (odocs==0) {
if (odocs == 0) {
break;
}
ZStrInsert(zstr, docpt, 2);

View File

@ -31,6 +31,7 @@
#ifdef TRI_HAVE_ICU
#include "unicode/normalizer2.h"
#include "unicode/ucasemap.h"
#include "unicode/brkiter.h"
#else
#include "string.h"
#endif
@ -67,39 +68,6 @@ Utf8Helper::~Utf8Helper () {
}
}
/*
int Utf8Helper::compareUtf8 (const char* left, size_t leftLength, const char* right, size_t rightLength) {
#ifdef TRI_HAVE_ICU
if (!_coll) {
LOGGER_ERROR << "no Collator in Utf8Helper::compareUtf8()!";
return 0;
}
UErrorCode status = U_ZERO_ERROR;
int result = _coll->compareUTF8(StringPiece(left, leftLength), StringPiece(right, rightLength), status);
if(U_FAILURE(status)) {
LOGGER_ERROR << "error in Collator::compareUTF8(...): " << u_errorName(status);
return 0;
}
return result;
#else
if (leftLength == rightLength) {
return memcmp((const void*)left, (const void*)right, leftLength);
}
int result = memcmp((const void*)left, (const void*)right, leftLength < rightLength ? leftLength : rightLength);
if (result == 0) {
if (leftLength < rightLength) {
return -1;
}
return 1;
}
return result;
#endif
}
*/
int Utf8Helper::compareUtf8 (const char* left, const char* right) {
#ifdef TRI_HAVE_ICU
if (!_coll) {

View File

@ -55,6 +55,7 @@ namespace triagens {
////////////////////////////////////////////////////////////////////////////////
/// @brief a default helper
////////////////////////////////////////////////////////////////////////////////
static Utf8Helper DefaultUtf8Helper;
public:
@ -84,7 +85,7 @@ namespace triagens {
////////////////////////////////////////////////////////////////////////////////
/// public functions
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief compare utf8 strings
/// -1 : left < right