create index for queries in format "//"

query 1: /div[@id=“5”]/note
with index created on attribute “id”, the processor will use the index

query 2: //div[@id=“5”]/note
with multipath indexed created on attribute “id”, the processor will use the index

query 3: /div[@id=“5”]//note
query 4: //div[@id=“5”]//note
no matter what kind of index created on “id”, no index is used.

how can I create index so that query 3 and 4 can use the index.

Hi

again usage of a multiPath standard index (available with Tamino 4.2) is the best answer.

Best regards
Uli

as you can see, I tried to use multipath index on attribute “id”, which case make the second query use the index. I also have been able to create a index on “Div” to make the 4th query to use the index on attribute “id”.

However, no matter what index I created, the 3rd query just don’t use the index on attribute “id”

Hi Eric

sorry - I missed that you are already using the multiPath index.
Could you pls provide the schema you are using?

Thanks
Uli

here is the schema I used.

I actually simplify a real schema I used to this one. You can still just define this schema
against a temp collection. I have created multipath index on “div”, “id”, and even “note”,
with this schema,
/div[@id]/note ----- use the index “id”
//div[@id]/note------ use the index “id”

//div[@id]//note and /div[@id]//note don’t use the index “id”

some how, in my real schema, //div[@id]//note works. anyway, how can we
make the two queries to use the index on “id”

the scenario I have is : many users will update the documents in a collection at the same time using queries in above format, if Tamino doesn’t use the index, then it will lock the whole
doctype when a user update a document, preventing others to update different document at the same time.

Hi

it looks like there is no attachement - I just try to attach a dummy doc for testing.

Regards
Uli
dummy.txt (11 Bytes)

so sorry, I forget to attach.
Notebook_Simple.tsd (2.19 KB)

Hi

why do you think that no index is being used?
If you are using _xql=ino:explain(…,“tree”) you’ll see, that indexes
are being used for both queries
//div[@id=“myId”]/note
and
//div[@id=“myId”]//note
if the doctype does already contain documents contributing to the indexes.
This restriction is related to the special nature of multiPath indexes.

Best regards
Uli

thanks for checking out that for me. However, I did have document in my doctype, and I also used the “explain” button in “inoxplorer” for the xquery I used.

//div[@id=“ab”]//note

and

/div[@id=“ab”]//note

don’t use index.

I posted 4 screenshot for you. 1.jpg and 2.jpg are the screen for the two queries not using index. Success.jpg is for the query using the index. And file.jpg is the file I have in under my doctype.

Thanks a lot.
screenshot.zip (266 KB)