-
-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Inconsistent treatment of prefixed attribute names in range index definitions #5189
Comments
@amclark42 If we can determine what the appropriate datatype would be to accommodate namespace prefixes, I'd gladly support merging a PR and would get a release of eXide out with an updated bundled |
@joewiz Thank you! Hm... |
@amclark42 Yes, that sounds like the right route! I thought I'd see if ChatGPT (GPT-4) could explain the difference between these two data types:
|
The Java code that processes: this.attributeName = elem.getAttribute("attribute");
if (this.attributeName == null || this.attributeName.isEmpty()) {
throw new DatabaseConfigurationException("Range index module: Empty or no attribute qname in condition");
}
try {
this.attribute = new QName(QName.extractLocalName(this.attributeName), XMLConstants.NULL_NS_URI, QName.extractPrefix(this.attributeName), ElementValue.ATTRIBUTE);
} catch (final QName.IllegalQNameException e) {
throw new DatabaseConfigurationException("Rand index module error: " + e.getMessage(), e);
} This code initially treats Looking at how these values are used by the indexer, we can see further issues - if you had the prefix I wonder if the schema may have intentionally automatically limited people to using an NCName to avoid the code's bug in QName handling? Regardless it looks like the intention of the original author of the Java code was to try and correctly handle QName's - and from what I understand you are saying @amclark42 that would be desirable behaviour. So we just need someone to send a PR to fix the Java code, and also then to update the |
Oh dang! Well sleuthed, @adamretter! |
Describe the bug
I created a collection configuration file with some range index fields defined. To make sure that only the elements I intend are indexed, I introduced a prefixed attribute,
@wwp:field
. The range index is set to index only those elements which has@wwp:field
with the correct value. Here’s an example of one of my range index settings:This index is working! However, when I opened the configuration file in eXide, it informed me that the value of
@attribute
was invalid:It is unclear to me whether the schema is wrong, or if the prefixed attribute should not actually be working for me.
When I went looking, I found that eXist has a schema for the configuration file, collection.xconf.xsd. eXide has a four-year-old copy of that schema. Both appear to define
@attribute
as anxs:NCName
.Expected behavior
The collection.xconf.xsd schema and eXist's range index should both refuse or accept prefixed attribute names in
@attribute
.To Reproduce
According to the above test, the conditional test for
@wwp:field
finds and indexes two matching<title>
s, but the conditional test for the NCNamefield
finds nothing to index.Context (please always complete the following information)
Additional context
conf.xml
? whitespace-preservation in serializationThe text was updated successfully, but these errors were encountered: