Files
@ caef0be39948
Branch filter:
Location: kallithea/tox.ini
caef0be39948
238 B
text/x-ini
search: make "repository:" condition work as expected
Before this revision, "repository:foo" condition at searching for
"File contents" or "File names" shows files in repositories below.
- foo
- foo/bar
- foo-bar
- and so on ...
Whoosh library, which is used to parse text for indexing and seaching,
does:
- treat almost all non-alphanumeric characters as delimiter both at
indexing search items and at parsing search condition
- make each fields for a search item be indexed by multiple values
For example, files in "foo/bar" repository are indexed by "foo" and
"bar" in "repository" field. This tokenization make "repository:foo"
search condition match against files in "foo/bar" repository, too.
In addition to it, using plain TEXT also causes unintentional
ignorance of "stop words" in search conditions. For example, "this",
"a", "you", and so on are ignored at indexing and parsing, because
these are too generic words (from point of view of generic "text
search").
This issue can't be resolved by using ID instead of TEXT for
"repository" of SCHEMA, like as previous revisions for JOURNAL_SCHEMA,
because:
- highlight-ing file content requires SCHEMA to support "positions"
feature, but using ID instead of TEXT disables it
- using ID violates current case-insensitive search policy, because
it preserves case of text
To make "repository:" condition work as expected, this revision
explicitly specifies "analyzer", which does:
- avoid tokenization
- match case-insensitively
- avoid removing "stop words" from text
This revision requires full re-building index tables, because indexing
schema is changed.
BTW, "repository:" condition at searching for "Commit messages" uses
CHGSETS_SCHEMA instead of SCHEMA. The former uses ID for "repository",
and it does:
- avoid issues by tokenization and removing "stop words"
- disable "positions" feature of CHGSETS_SCHEMA
But highlight-ing file content isn't needed at searching for
"Commit messages". Therefore, this can be ignored.
- preserve case of text
This violates current case-insensitive search policy, This issue
will be fixed by subsequent revision, because fixing it isn't so
simple.
Before this revision, "repository:foo" condition at searching for
"File contents" or "File names" shows files in repositories below.
- foo
- foo/bar
- foo-bar
- and so on ...
Whoosh library, which is used to parse text for indexing and seaching,
does:
- treat almost all non-alphanumeric characters as delimiter both at
indexing search items and at parsing search condition
- make each fields for a search item be indexed by multiple values
For example, files in "foo/bar" repository are indexed by "foo" and
"bar" in "repository" field. This tokenization make "repository:foo"
search condition match against files in "foo/bar" repository, too.
In addition to it, using plain TEXT also causes unintentional
ignorance of "stop words" in search conditions. For example, "this",
"a", "you", and so on are ignored at indexing and parsing, because
these are too generic words (from point of view of generic "text
search").
This issue can't be resolved by using ID instead of TEXT for
"repository" of SCHEMA, like as previous revisions for JOURNAL_SCHEMA,
because:
- highlight-ing file content requires SCHEMA to support "positions"
feature, but using ID instead of TEXT disables it
- using ID violates current case-insensitive search policy, because
it preserves case of text
To make "repository:" condition work as expected, this revision
explicitly specifies "analyzer", which does:
- avoid tokenization
- match case-insensitively
- avoid removing "stop words" from text
This revision requires full re-building index tables, because indexing
schema is changed.
BTW, "repository:" condition at searching for "Commit messages" uses
CHGSETS_SCHEMA instead of SCHEMA. The former uses ID for "repository",
and it does:
- avoid issues by tokenization and removing "stop words"
- disable "positions" feature of CHGSETS_SCHEMA
But highlight-ing file content isn't needed at searching for
"Commit messages". Therefore, this can be ignored.
- preserve case of text
This violates current case-insensitive search policy, This issue
will be fixed by subsequent revision, because fixing it isn't so
simple.