how to index properly?

I have an urgent problem, if someone could help. I have an XML file, which basically looks like this:


text value



I then index the

element with standard index in the schema as follows:
<xs:element name = “pa”>
<xs:complexType mixed = “true”>
<xs:choice minOccurs = “0” maxOccurs = “unbounded”>
<xs:element ref = “abbr”></xs:element>
<xs:element ref = “address”></xs:element>
<xs:attribute name = “corresp” type = “xs:IDREFS”></xs:attribute>
<xs:attribute name = “synch” type = “xs:IDREFS”></xs:attribute>

The problem is the performance for the text retrieval query is not improved, rather degraded a bit. And in the output from adding <?explain?> to the query, I did not see any XqcUnnestStdIdxScan element. Does this mean I did not index correctly. FYI, the query I executed is as follows:

for $a in input()/TEI/TEI.2/body//p[contains(.“Omaha”)]
return $a


In order to improve the performance of text retrieval queries you have to define a text index on the elements you want to query. You also should use the tf:containsText() function instead of contains().

Best regards,

Thorsten Fiebig

I tried the text index too. But when I trace the output using {?explain?}, the element was not shown to be indexed. What went wrong?


Did you use the tf:containsText() function? The according query looks like this:

declare namespace tf=“
for $a in input()/TEI/TEI.2/body//p
where tf:containsText($a,“Omaha”)
return $a

Best Regards,

Thorsten Fiebig

Yes, I tried ft:containsText(). But I don’t think it is indexed. To make sure, which element should I look for in the {?explain?} output to see that the element is indexed?