Skip to content

"navtree" handling buggy for "level > 0" #13

Description

@d-maurer

Consider the following setup:

>>> from Products.ExtendedPathIndex.ExtendedPathIndex import ExtendedPathIndex
>>> 
>>> class _O(object):
...   def __init__(self, pi): self.pi = pi
... 
>>> pi = ExtendedPathIndex("pi")
>>> 
>>> paths = {}
>>> for leaf in ("1/1 1/12/121 1/12/122 2/21/1".split()):
...   comps = leaf.split("/")
...   pd = paths
...   for c in comps:
...     if c not in pd: pd[c] = {}
...     pd = pd[c]
... 
>>> def gen(prefix, pd):
...   for c in sorted(pd):
...     np = prefix + "/" + c
...     yield np
...     yield from gen(np, pd[c])
... 
>>> 
>>> for i, p in enumerate(gen("", paths)):
...   print (i, p)
...   indexed = pi.index_object(i, _O(p))
... 
0 /1
1 /1/1
2 /1/12
3 /1/12/121
4 /1/12/122
5 /2
6 /2/21
7 /2/21/1

This means that /1/1 is the only path with 1 at level 1. As a consequence, search("/1/1", default_level=0, ...) and search("1", default_level=1, ...) must give the same results but:

>>> pi.search("/1/1", default_level=0, depth=0, navtree=True)
IISet([0, 1])
>>> pi.search("1", default_level=1, depth=0, navtree=True)
IISet([1])
>>> 
>>> pi.search("/1/1", default_level=0, depth=1, navtree=True)
IISet([0, 1, 2, 5])
>>> pi.search("1", default_level=1, depth=1, navtree=True)
IISet([0, 1, 2, 5, 6])

The results for default_level=1 are obviously wrong.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions