Reference index on node referenced by index of node itself


I am working with documents that look like:

Car Red Bike Blue

Descriptor can appear multiple times in a Segment and each descriptor has an Id (@DscId) and a value (the text of the Descriptor node).

I want to define an index that combines both @DscId and the value in order to improve queries like “give me the Segments that has Red value in Descriptor 2”.

A compound index does not fit because I want to use containsText function for the values (and a compound index is a standard index and not a text one).

So I am trying to define a Reference index. I have a text index in the Descriptor node (for the value) and a standard index in the DscId attribute.
Then I define a reference index in Descriptor and set a reference to /Segment/Descriptor in the previous two indexes. But I get an error when I try to upload the schema in the database:

“The path defined in tsd:refers has to point to an element which is a predecessor of the element or attribute where it is defined”

It seems that the text index of Descriptor cannot refer to a reference index of Descriptor. Is that true? There is no way of doing it?

In the case of compound index you can specify “.” to refer to the node itself, but how to do the same with reference index?

I know I can move the value of the descriptor to a Value subnode, but I want to be sure that there is no way to do it without changing the schema (because we will have to make a lot of changes in our application to introduce this Value subnode)


Hi Mark,

just put the reference index on the node. This will support you r kind of query: find segments that have a specific DscId and Descriptor value.

Best regards,