Possible Indexes

Hello,

I am wondering if Tamino allows the creation of custom indexes, ie, the following indexes:

  • /book/author

  • //author

  • //title/*

  • //book[isb=“34343”]

Any reply would be appreciated.

Thanks.

Best Regards,
Salem

Hi Salem

a general remark: only values of nodes which are validated vs the schema
will be entered into an index by Tamino. This means:

  • wildcards (xs:any / xs:anyAttribute)
    if a node is allowed due to a wildcard with processContents=“skip”
    or processContents=“lax” without an appropriate global element or
    attribute declaration, no validation is performed, hence no index entry
    will be created
  • open content: a node being allowed in the instance because
    (a) the doctype is set to “open content”
    (b) there is no explicit schema (schemaless collection)
    will not contribute to an index
  1. /book/author
    This is the simplest scenario - just define a stadard or text index on the
    “author” element
    => OK

  2. //author
    (a) finding all documents which just contain the author element at any
    path is most efficiently possible via a full structure index.
    (b) If you want to find all author nodes having a specific value, you
    should define a multiPath index on the ‘author’ node(s)
    (there might be multiple local or a global element declaration in the
    schema)
    => OK

  3. //title/*
    There os no index in Tamino which does directly support a query like
    e.g. //title/*[.=“hello”]. To some extent a full structure index will help

  4. //book[isb=“34343”]
    This is scenario (2b) => OK

Best regards
Uli

Thank you very much for your reply.

A) From what I understood, the collection must have a schema, if there is no schema, then no indexes can be created

B) What about the following indexes, can they be created

B.1) /a/b//c
B.2) /a//a [recursive]

C) Assuming that we have an index on /a/b, can this benefit a query such as ‘/a/b/c’ ? or assume that we have an index on /b/c, would this benefit a query such as ‘/a/b/c’

Thank you very much.

Regards,
Salem

Hi,

A) This is correct. To define an index you have to define a schema.

B1) If your query is /a/b//c and the only path occuring in your data is /a/b/c then the query takes advantage of that index. If there is more than just this single path then you should define a multi-path index (suppported in Tamino 4.2) . For more details please have a look at the Tamino documentation.

B2) This kind of queries require a multi-path index

C) In certain cases an index on /a/b might help to process the query /a/b/c. But as a rule of thumb an index should be defined on the queried elements or attributes.

Best Regards,

Thorsten Fiebig