Issue #261: journal filtering doesn't work for repository name with group (conservancy/kallithea)

Katsunori FUJIWARA issues-reply at bitbucket.org
Wed Dec 28 11:43:07 UTC 2016


New issue 261: journal filtering doesn't work for repository name with group
https://bitbucket.org/conservancy/kallithea/issues/261/journal-filtering-doesnt-work-for

Katsunori FUJIWARA:

Journal filtering with a condition "repository:foo/bar" can't
pick up entries for repository "foo/bar" (= repository "bar" belonging to group "foo").

AFAIK, Whoosh library (at least 2.5.7) treats "repository:foo/bar" as "repository == foo AND
repository == bar" unintentionally.

You can reproduce this unexpected(?) behavior of Whoosh library by Python
script below. This is minimum part of building query from filter
condition in Kallithea.


```
#!python

from whoosh.fields import (
    TEXT, ID, STORED, NUMERIC,
    BOOLEAN, Schema, FieldType, DATETIME
)
from whoosh.qparser.dateparse import DateParserPlugin
from whoosh.qparser.default import QueryParser

# from kallithea/lib/indexers/__init__.py
JOURNAL_SCHEMA = Schema(
    username=TEXT(),
    date=DATETIME(),
    action=TEXT(),
    repository=TEXT(),
    ip=TEXT(),
)

# from _journal_filter()@kallithea/controllers/admin/admin.py
qp = QueryParser('repository', schema=JOURNAL_SCHEMA)
qp.add_plugin(DateParserPlugin())

# with wildcard, treated as prefix matching
print repr(qp.parse(u'repository:foo/bar*'))
# without wildcard, treated as AND-ed conditions
print repr(qp.parse(u'repository:foo/bar'))

```

BTW, if you don't have group, of which name ends with "foo", suffix matching "repository:*foo/bar" may be used as an instant workaround.





More information about the kallithea-general mailing list