1
0
Fork 0

unify index struct return values in cluster and non-cluster for fulltext and geo indexes (#2534)

This commit is contained in:
Jan 2017-06-08 13:35:00 +02:00 committed by Frank Celler
parent ae429ecf23
commit 5ad9423f16
4 changed files with 22 additions and 8 deletions

View File

@ -114,8 +114,6 @@ MMFilesFulltextIndex::MMFilesFulltextIndex(TRI_idx_iid_t iid,
} }
} }
MMFilesFulltextIndex::~MMFilesFulltextIndex() { MMFilesFulltextIndex::~MMFilesFulltextIndex() {
if (_fulltextIndex != nullptr) { if (_fulltextIndex != nullptr) {
LOG_TOPIC(TRACE, arangodb::Logger::FIXME) << "destroying fulltext index"; LOG_TOPIC(TRACE, arangodb::Logger::FIXME) << "destroying fulltext index";

View File

@ -170,9 +170,13 @@ static int EnhanceJsonIndexPersistent(VPackSlice const definition,
static void ProcessIndexGeoJsonFlag(VPackSlice const definition, static void ProcessIndexGeoJsonFlag(VPackSlice const definition,
VPackBuilder& builder) { VPackBuilder& builder) {
VPackSlice fieldsSlice = definition.get("fields");
if (fieldsSlice.isArray() && fieldsSlice.length() == 1) {
// only add geoJson for indexes with a single field (with needs to be an array)
bool geoJson = bool geoJson =
basics::VelocyPackHelper::getBooleanValue(definition, "geoJson", false); basics::VelocyPackHelper::getBooleanValue(definition, "geoJson", false);
builder.add("geoJson", VPackValue(geoJson)); builder.add("geoJson", VPackValue(geoJson));
}
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -221,6 +225,10 @@ static int EnhanceJsonIndexFulltext(VPackSlice const definition,
VPackBuilder& builder, bool create) { VPackBuilder& builder, bool create) {
int res = ProcessIndexFields(definition, builder, 1, create); int res = ProcessIndexFields(definition, builder, 1, create);
if (res == TRI_ERROR_NO_ERROR) { if (res == TRI_ERROR_NO_ERROR) {
// hard-coded defaults
builder.add("sparse", VPackValue(true));
builder.add("unique", VPackValue(false));
// handle "minLength" attribute // handle "minLength" attribute
int minWordLength = TRI_FULLTEXT_MIN_WORD_LENGTH_DEFAULT; int minWordLength = TRI_FULLTEXT_MIN_WORD_LENGTH_DEFAULT;
VPackSlice minLength = definition.get("minLength"); VPackSlice minLength = definition.get("minLength");

View File

@ -170,9 +170,13 @@ static int EnhanceJsonIndexPersistent(VPackSlice const definition,
static void ProcessIndexGeoJsonFlag(VPackSlice const definition, static void ProcessIndexGeoJsonFlag(VPackSlice const definition,
VPackBuilder& builder) { VPackBuilder& builder) {
VPackSlice fieldsSlice = definition.get("fields");
if (fieldsSlice.isArray() && fieldsSlice.length() == 1) {
// only add geoJson for indexes with a single field (with needs to be an array)
bool geoJson = bool geoJson =
basics::VelocyPackHelper::getBooleanValue(definition, "geoJson", false); basics::VelocyPackHelper::getBooleanValue(definition, "geoJson", false);
builder.add("geoJson", VPackValue(geoJson)); builder.add("geoJson", VPackValue(geoJson));
}
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -222,6 +226,10 @@ static int EnhanceJsonIndexFulltext(VPackSlice const definition,
VPackBuilder& builder, bool create) { VPackBuilder& builder, bool create) {
int res = ProcessIndexFields(definition, builder, 1, create); int res = ProcessIndexFields(definition, builder, 1, create);
if (res == TRI_ERROR_NO_ERROR) { if (res == TRI_ERROR_NO_ERROR) {
// hard-coded defaults
builder.add("sparse", VPackValue(true));
builder.add("unique", VPackValue(false));
// handle "minLength" attribute // handle "minLength" attribute
int minWordLength = TRI_FULLTEXT_MIN_WORD_LENGTH_DEFAULT; int minWordLength = TRI_FULLTEXT_MIN_WORD_LENGTH_DEFAULT;
VPackSlice minLength = definition.get("minLength"); VPackSlice minLength = definition.get("minLength");