Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add an element range index on native JSON with colon

Tags:

json

marklogic

I'm trying to add an range index on a Native JSON property which has colon(:) in its name in MarkLogic Server.

The sample data is as follows.

{
  "Aspects": {
"xbrl28:TransactionTime": "2014-08-13T00:00:00+0000",
"xbrl28:Archive": "S1002U7K",
"xbrl:Period": "2014-08-13"
  },
  "_id": "27948e6d-a774-49ee-8e30-668cc4731975"
}

When I tried to add an range index on "xbrl28:Archive", but I cannot, because the "xbrl28:" was treated as prefix of a namespace. Is there any way to escape the colon?

like image 387
Hisao Motoyama Avatar asked Mar 10 '16 06:03

Hisao Motoyama


1 Answers

You cannot use element range indexes for JSON properties with colons, spaces or any other name that does not conform to xs:QName. I haven't tried, but you could try using a path index with an expression like: node()[name() = "xbrl28:Archive"] or better: text("xbrl28:Archive").

HTH!

like image 196
grtjn Avatar answered Nov 15 '22 03:11

grtjn