Am 29.03.2020 um 16:26 schrieb Martin Honnen:
Using BaseX 9.3.2, why does a query
collection('/test-db-1/bib')//Q{}libro
return 6 items while
collection('/test-db-1/bib')//libro
gives 0 items?
If I run
collection('/test-db-1/bib')//Q{}libro, collection('/test-db-1/bib')//libro
the info window shows
Compiling:
- rewrite fn:collection([uri]) to document-node() item:
collection("/test-db-1/bib") -> db:open-pre("test-db-1", 12000002)
- merge steps: descendant::element(libro)
- rewrite fn:collection([uri]) to document-node() item:
collection("/test-db-1/bib") -> db:open-pre("test-db-1", 12000002)
- remove step without results: element(libro)
- rewrite iter step to empty sequence: element(libro) -> ()
- rewrite cached path to empty sequence: db:open-pre("test-db-1",
12000002)/descendant-or-self::node()/() -> ()
- rewrite expression list to iter path: (db:open-pre("test-db-1",
12000002)/descendant::element(libro), ()) -> db:open-pre("test-db-1", 12000002)/descendant::element(libro) Optimized Query: db:open-pre("test-db-1", 12000002)/descendant::element(libro) Query: collection('/test-db-1/bib')//Q{}libro, collection('/test-db-1/bib')//libro Result:
- Hit(s): 6 Items
- Updated: 0 Items
- Printed: 1455 b
- Read Locking: test-db-1
- Write Locking: (none)
It seems the problems occurs if I have one document in the db that has elements in a namespace and one with elements in no namespace.
So if there is only one document with no namespaces then both collection('/test-db-3/ex2')//foo and collection('/test-db-3/ex2')//Q{}foo select the `foo` elements in no namespace but if there is a document using a namespace as well in the db then collection('/test-db-3/ex2')//foo does not select the `foo` elements in no namespace.
Are there any db/namespace related settings in BaseX that cause that behaviour?