mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
Fix subtype indexing. Really really made it the default.
This commit is contained in:
parent
c4164193ad
commit
2e8a98e3a1
@ -43,7 +43,7 @@ static slap_mask_t index_mask(
|
|||||||
/* has language tag */
|
/* has language tag */
|
||||||
bdb_attr_mask( be->be_private, desc->ad_type->sat_ad, &mask );
|
bdb_attr_mask( be->be_private, desc->ad_type->sat_ad, &mask );
|
||||||
|
|
||||||
if (! ( mask & SLAP_INDEX_NOLANG ) ) {
|
if ( mask && ( mask ^ SLAP_INDEX_NOLANG ) ) {
|
||||||
*atname = desc->ad_type->sat_cname;
|
*atname = desc->ad_type->sat_cname;
|
||||||
*dbname = desc->ad_type->sat_cname.bv_val;
|
*dbname = desc->ad_type->sat_cname.bv_val;
|
||||||
return mask;
|
return mask;
|
||||||
@ -57,19 +57,11 @@ static slap_mask_t index_mask(
|
|||||||
|
|
||||||
bdb_attr_mask( be->be_private, at->sat_ad, &mask );
|
bdb_attr_mask( be->be_private, at->sat_ad, &mask );
|
||||||
|
|
||||||
if( mask & SLAP_INDEX_AUTO_SUBTYPES ) {
|
if ( mask && ( mask ^ SLAP_INDEX_NOSUBTYPES ) ) {
|
||||||
*atname = desc->ad_type->sat_cname;
|
*atname = desc->ad_type->sat_cname;
|
||||||
*dbname = at->sat_cname.bv_val;
|
*dbname = at->sat_cname.bv_val;
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !( mask & SLAP_INDEX_NOSUBTYPES ) ) {
|
|
||||||
*atname = at->sat_cname;
|
|
||||||
*dbname = at->sat_cname.bv_val;
|
|
||||||
return mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( mask ) break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -299,7 +291,7 @@ static int index_at_values(
|
|||||||
|
|
||||||
if( mask ) {
|
if( mask ) {
|
||||||
*dbnamep = type->sat_cname.bv_val;
|
*dbnamep = type->sat_cname.bv_val;
|
||||||
} else if ( !( tmpmask & SLAP_INDEX_AUTO_SUBTYPES ) ) {
|
} else if ( tmpmask ^ SLAP_INDEX_NOSUBTYPES ) {
|
||||||
mask = tmpmask;
|
mask = tmpmask;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,6 +302,7 @@ static int index_at_values(
|
|||||||
mask );
|
mask );
|
||||||
|
|
||||||
if( rc ) return rc;
|
if( rc ) return rc;
|
||||||
|
*maskp = mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( lang->bv_len ) {
|
if( lang->bv_len ) {
|
||||||
|
@ -39,7 +39,7 @@ static slap_mask_t index_mask(
|
|||||||
/* has language tag */
|
/* has language tag */
|
||||||
attr_mask( be->be_private, desc->ad_type->sat_ad, &mask );
|
attr_mask( be->be_private, desc->ad_type->sat_ad, &mask );
|
||||||
|
|
||||||
if( !( mask & SLAP_INDEX_NOLANG ) ) {
|
if( mask && ( mask ^ SLAP_INDEX_NOLANG ) ) {
|
||||||
*atname = desc->ad_type->sat_cname;
|
*atname = desc->ad_type->sat_cname;
|
||||||
*dbname = desc->ad_type->sat_cname.bv_val;
|
*dbname = desc->ad_type->sat_cname.bv_val;
|
||||||
return mask;
|
return mask;
|
||||||
@ -47,25 +47,18 @@ static slap_mask_t index_mask(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* see if supertype defined mask for its subtypes */
|
/* see if supertype defined mask for its subtypes */
|
||||||
for( at = desc->ad_type; at != NULL ; at = at->sat_sup ) {
|
for( at = desc->ad_type->sat_sup; at != NULL ; at = at->sat_sup ) {
|
||||||
/* If no AD, we've never indexed this type */
|
/* If no AD, we've never indexed this type */
|
||||||
if (!at->sat_ad)
|
if (!at->sat_ad)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
attr_mask( be->be_private, at->sat_ad, &mask );
|
attr_mask( be->be_private, at->sat_ad, &mask );
|
||||||
|
|
||||||
if( mask & SLAP_INDEX_AUTO_SUBTYPES ) {
|
if( mask && ( mask ^ SLAP_INDEX_NOSUBTYPES ) ) {
|
||||||
*atname = desc->ad_type->sat_cname;
|
*atname = desc->ad_type->sat_cname;
|
||||||
*dbname = at->sat_cname.bv_val;
|
*dbname = at->sat_cname.bv_val;
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
if( !( mask & SLAP_INDEX_NOSUBTYPES ) ) {
|
|
||||||
*atname = at->sat_cname;
|
|
||||||
*dbname = at->sat_cname.bv_val;
|
|
||||||
return mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( mask ) break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -264,7 +257,7 @@ static int index_at_values(
|
|||||||
|
|
||||||
if( mask ) {
|
if( mask ) {
|
||||||
*dbnamep = type->sat_cname.bv_val;
|
*dbnamep = type->sat_cname.bv_val;
|
||||||
} else if ( tmpmask & SLAP_INDEX_AUTO_SUBTYPES ) {
|
} else if ( tmpmask ^ SLAP_INDEX_NOSUBTYPES ) {
|
||||||
mask = tmpmask;
|
mask = tmpmask;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,6 +266,7 @@ static int index_at_values(
|
|||||||
&type->sat_cname,
|
&type->sat_cname,
|
||||||
vals, id, op,
|
vals, id, op,
|
||||||
mask );
|
mask );
|
||||||
|
*maskp = mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( lang->bv_len ) {
|
if( lang->bv_len ) {
|
||||||
|
@ -56,8 +56,6 @@ int slap_str2index( const char *str, slap_mask_t *idx )
|
|||||||
*idx = SLAP_INDEX_NOLANG;
|
*idx = SLAP_INDEX_NOLANG;
|
||||||
} else if ( strcasecmp( str, "nosubtypes" ) == 0 ) {
|
} else if ( strcasecmp( str, "nosubtypes" ) == 0 ) {
|
||||||
*idx = SLAP_INDEX_NOSUBTYPES;
|
*idx = SLAP_INDEX_NOSUBTYPES;
|
||||||
} else if ( strcasecmp( str, "autosubtypes" ) == 0 ) {
|
|
||||||
*idx = SLAP_INDEX_AUTO_SUBTYPES;
|
|
||||||
} else {
|
} else {
|
||||||
return LDAP_OTHER;
|
return LDAP_OTHER;
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,6 @@ typedef struct slap_ssf_set {
|
|||||||
#define SLAP_INDEX_FLAGS 0xF000UL
|
#define SLAP_INDEX_FLAGS 0xF000UL
|
||||||
#define SLAP_INDEX_NOSUBTYPES 0x1000UL /* don't use index w/ subtypes */
|
#define SLAP_INDEX_NOSUBTYPES 0x1000UL /* don't use index w/ subtypes */
|
||||||
#define SLAP_INDEX_NOLANG 0x2000UL /* don't use index w/ lang */
|
#define SLAP_INDEX_NOLANG 0x2000UL /* don't use index w/ lang */
|
||||||
#define SLAP_INDEX_AUTO_SUBTYPES 0x4000UL /* use mask with lang subtypes */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* there is a single index for each attribute. these prefixes ensure
|
* there is a single index for each attribute. these prefixes ensure
|
||||||
|
Loading…
Reference in New Issue
Block a user