seecr-sil 3.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- seecr_sil-3.4.0/.flake8 +18 -0
- seecr_sil-3.4.0/.githooks/pre-push +35 -0
- seecr_sil-3.4.0/.github/dependabot.yml +10 -0
- seecr_sil-3.4.0/.github/workflows/publish.yml +64 -0
- seecr_sil-3.4.0/.github/workflows/test.yml +37 -0
- seecr_sil-3.4.0/.gitignore +6 -0
- seecr_sil-3.4.0/CHANGELOG.md +120 -0
- seecr_sil-3.4.0/CLAUDE.md +84 -0
- seecr_sil-3.4.0/LICENSE +21 -0
- seecr_sil-3.4.0/PKG-INFO +62 -0
- seecr_sil-3.4.0/README.md +33 -0
- seecr_sil-3.4.0/SECURITY.md +19 -0
- seecr_sil-3.4.0/doc/license.conf +8 -0
- seecr_sil-3.4.0/doc/reference.md +307 -0
- seecr_sil-3.4.0/pyproject.toml +62 -0
- seecr_sil-3.4.0/pytest.ini +5 -0
- seecr_sil-3.4.0/seecr_sil.egg-info/PKG-INFO +62 -0
- seecr_sil-3.4.0/seecr_sil.egg-info/SOURCES.txt +39 -0
- seecr_sil-3.4.0/seecr_sil.egg-info/dependency_links.txt +1 -0
- seecr_sil-3.4.0/seecr_sil.egg-info/requires.txt +1 -0
- seecr_sil-3.4.0/seecr_sil.egg-info/scm_file_list.json +35 -0
- seecr_sil-3.4.0/seecr_sil.egg-info/scm_version.json +8 -0
- seecr_sil-3.4.0/seecr_sil.egg-info/top_level.txt +1 -0
- seecr_sil-3.4.0/setup.cfg +4 -0
- seecr_sil-3.4.0/sil/__init__.py +16 -0
- seecr_sil-3.4.0/sil/_version.py +24 -0
- seecr_sil-3.4.0/sil/ascii_folding_test.py +89 -0
- seecr_sil-3.4.0/sil/commit.py +42 -0
- seecr_sil-3.4.0/sil/cql.py +342 -0
- seecr_sil-3.4.0/sil/cql_test.py +207 -0
- seecr_sil-3.4.0/sil/drilldown.py +110 -0
- seecr_sil-3.4.0/sil/drilldown_test.py +132 -0
- seecr_sil-3.4.0/sil/engine.py +140 -0
- seecr_sil-3.4.0/sil/engine_test.py +59 -0
- seecr_sil-3.4.0/sil/index.py +599 -0
- seecr_sil-3.4.0/sil/index_test.py +998 -0
- seecr_sil-3.4.0/sil/indexfield.py +337 -0
- seecr_sil-3.4.0/sil/indexprofile.py +40 -0
- seecr_sil-3.4.0/sil/suggester.py +93 -0
- seecr_sil-3.4.0/sil/testdata/restart-opstamp.tar.gz +0 -0
- seecr_sil-3.4.0/sil/utils.py +38 -0
seecr_sil-3.4.0/.flake8
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[flake8]
|
|
2
|
+
exclude =
|
|
3
|
+
.git,
|
|
4
|
+
__pycache__,
|
|
5
|
+
build,
|
|
6
|
+
dist,
|
|
7
|
+
# the virtual environment
|
|
8
|
+
env,
|
|
9
|
+
extend-ignore =
|
|
10
|
+
# E266 too many leading '#' for block comment (the license header)
|
|
11
|
+
E266,
|
|
12
|
+
# E203 whitespace before ':' (black puts it in slices)
|
|
13
|
+
E203,
|
|
14
|
+
per-file-ignores =
|
|
15
|
+
# unused imports in __init__
|
|
16
|
+
sil/__init__.py:F401,E402
|
|
17
|
+
|
|
18
|
+
max-line-length = 88
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Before `git push`: flake8, isort and the tests, so a push does not bring broken or
|
|
3
|
+
# unformatted code to others. Turn it on once per clone:
|
|
4
|
+
#
|
|
5
|
+
# git config core.hooksPath .githooks
|
|
6
|
+
#
|
|
7
|
+
# flake8, isort and pytest come from the dev dependency group in pyproject.toml
|
|
8
|
+
# (pip install -e . --group dev). Push anyway (e.g. work in progress on a branch): git push --no-verify
|
|
9
|
+
|
|
10
|
+
cd "$(git rev-parse --show-toplevel)" || exit 1
|
|
11
|
+
|
|
12
|
+
# the project's virtualenv if there is one, else whatever python is active
|
|
13
|
+
PYTHON=python3
|
|
14
|
+
[ -x env/bin/python ] && PYTHON=env/bin/python
|
|
15
|
+
|
|
16
|
+
fail() {
|
|
17
|
+
echo
|
|
18
|
+
echo "pre-push: $1; not pushed (git push --no-verify to push anyway)"
|
|
19
|
+
exit 1
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
for tool in flake8 isort pytest; do
|
|
23
|
+
"$PYTHON" -m $tool --version > /dev/null 2>&1 ||
|
|
24
|
+
fail "$tool is missing: $PYTHON -m pip install -e . --group dev"
|
|
25
|
+
done
|
|
26
|
+
|
|
27
|
+
echo "pre-push: flake8"
|
|
28
|
+
"$PYTHON" -m flake8 sil || fail "flake8 found problems"
|
|
29
|
+
|
|
30
|
+
echo "pre-push: isort"
|
|
31
|
+
"$PYTHON" -m isort --check-only --diff sil ||
|
|
32
|
+
fail "imports not sorted (isort sil)"
|
|
33
|
+
|
|
34
|
+
echo "pre-push: tests"
|
|
35
|
+
"$PYTHON" -m pytest -q sil || fail "tests failed"
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
# Publishes when a MAJOR.MINOR.PATCH tag (e.g. 0.6.0) is pushed. The tag
|
|
4
|
+
# becomes the package version via setuptools_scm. After the upload, a GitHub
|
|
5
|
+
# release is made with that version's section of CHANGELOG.md.
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
tags: ["[0-9]+.[0-9]+.[0-9]+"]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v7
|
|
15
|
+
with:
|
|
16
|
+
fetch-depth: 0
|
|
17
|
+
- uses: actions/setup-python@v7
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.13"
|
|
20
|
+
- name: CHANGELOG.md has a section for this version
|
|
21
|
+
run: grep -q "^## $GITHUB_REF_NAME " CHANGELOG.md
|
|
22
|
+
- run: pip install build twine
|
|
23
|
+
- run: python -m build
|
|
24
|
+
- run: twine check --strict dist/*
|
|
25
|
+
- uses: actions/upload-artifact@v7
|
|
26
|
+
with:
|
|
27
|
+
name: dist
|
|
28
|
+
path: dist/
|
|
29
|
+
|
|
30
|
+
publish:
|
|
31
|
+
needs: build
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
environment:
|
|
34
|
+
name: pypi
|
|
35
|
+
url: https://pypi.org/project/seecr-sil/
|
|
36
|
+
permissions:
|
|
37
|
+
id-token: write # PyPI trusted publishing, no API token needed
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/download-artifact@v8
|
|
40
|
+
with:
|
|
41
|
+
name: dist
|
|
42
|
+
path: dist/
|
|
43
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
44
|
+
|
|
45
|
+
release:
|
|
46
|
+
needs: publish
|
|
47
|
+
runs-on: ubuntu-latest
|
|
48
|
+
permissions:
|
|
49
|
+
contents: write # to create the release
|
|
50
|
+
steps:
|
|
51
|
+
- uses: actions/checkout@v7
|
|
52
|
+
- uses: actions/download-artifact@v8
|
|
53
|
+
with:
|
|
54
|
+
name: dist
|
|
55
|
+
path: dist/
|
|
56
|
+
- name: Release notes from CHANGELOG.md
|
|
57
|
+
run: |
|
|
58
|
+
awk -v v="$GITHUB_REF_NAME" '/^## /{p = ($2 == v)} p && !/^## /' CHANGELOG.md > notes.md
|
|
59
|
+
if ! grep -q . notes.md; then
|
|
60
|
+
echo "See [CHANGELOG.md](https://github.com/seecr/sil/blob/master/CHANGELOG.md)." > notes.md
|
|
61
|
+
fi
|
|
62
|
+
- run: gh release create "$GITHUB_REF_NAME" dist/* --title "$GITHUB_REF_NAME" --notes-file notes.md
|
|
63
|
+
env:
|
|
64
|
+
GH_TOKEN: ${{ github.token }}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
# Version tags are tested by the push of the commit itself; publish.yml handles the tag.
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
branches: ["**"]
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
fail-fast: false
|
|
14
|
+
matrix:
|
|
15
|
+
python-version: ["3.11", "3.12", "3.13", "3.14"]
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v7
|
|
18
|
+
with:
|
|
19
|
+
fetch-depth: 0 # setuptools_scm needs the tags
|
|
20
|
+
- uses: actions/setup-python@v7
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
- run: python -m pip install --upgrade pip # --group needs pip 25.1
|
|
24
|
+
- run: pip install -e . --group dev
|
|
25
|
+
- run: python -m pytest sil
|
|
26
|
+
|
|
27
|
+
flake8:
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/checkout@v7
|
|
31
|
+
- uses: actions/setup-python@v7
|
|
32
|
+
with:
|
|
33
|
+
python-version: "3.13"
|
|
34
|
+
- run: python -m pip install --upgrade pip # --group needs pip 25.1
|
|
35
|
+
- run: pip install --group dev
|
|
36
|
+
- run: flake8 sil
|
|
37
|
+
- run: isort --check-only --diff sil
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 3.4.0 (2026-11-23)
|
|
4
|
+
|
|
5
|
+
First release on PyPI: `pip install seecr-sil` (the import stays `sil`).
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- setuptools-scm is no longer installed with sil (it is only needed to build it); the
|
|
10
|
+
only dependency is tantivy. The dev tools (flake8, isort, pytest) are the `dev`
|
|
11
|
+
dependency group in `pyproject.toml` (`pip install -e . --group dev`);
|
|
12
|
+
`requirements-dev.txt` is gone.
|
|
13
|
+
- The package metadata names the license as an SPDX expression (`MIT`).
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- Published on GitHub (https://github.com/seecr/sil) and PyPI as `seecr-sil` (the name
|
|
18
|
+
`sil` was taken there): `pip install seecr-sil`; the import stays `import sil`. An
|
|
19
|
+
application that depends on `sil` now depends on `seecr-sil`; in an existing
|
|
20
|
+
virtualenv, `pip uninstall sil` first (both install the `sil` package). Project URLs and
|
|
21
|
+
classifiers in the metadata, tests in GitHub Actions, and a release to PyPI for every
|
|
22
|
+
version tag.
|
|
23
|
+
|
|
24
|
+
## 3.3.0 (2026-11-20)
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- Hierarchical drilldown: `IndexField.untokenized(name, drilldown=True,
|
|
29
|
+
hierarchical=True)`. Values are paths (a tuple of levels, or levels with `>` between
|
|
30
|
+
them); the drilldown gives a tree of `(value, count, subvalues)`, with `path` (start
|
|
31
|
+
below a value) and `depth` in the request; a term query on a level finds everything
|
|
32
|
+
below it. See "Hierarchical drilldown" in `doc/reference.md`.
|
|
33
|
+
- Drilldown `"count": 0` gives all values (as meresco-lucene's `maxTerms=0`).
|
|
34
|
+
- `ascii_folding=True` for text and unqualified fields: `cafe` finds `Café`, `strasse`
|
|
35
|
+
finds `Straße`, in the query language, prefixes and CQL alike (as meresco-lucene's
|
|
36
|
+
analyzer). Turning it on or off for a field changes the schema: reindex.
|
|
37
|
+
- CQL: `Index.cql_query(cql)` and `Index.search_cql(cql, ...)`, with `sil.cql.parse`,
|
|
38
|
+
`rewrite` and `to_cql` for the tree. Gives the hits Meresco (cqlparser,
|
|
39
|
+
meresco-lucene) gave, including its precedence (`OR` binds weakest). Own parser, no
|
|
40
|
+
new dependency. See "CQL" in `doc/reference.md`.
|
|
41
|
+
|
|
42
|
+
No change to the schema of existing fields: no reindex needed.
|
|
43
|
+
|
|
44
|
+
## 3.2.0 (2026-11-16)
|
|
45
|
+
|
|
46
|
+
**Rebuild every index after upgrading.** It removes duplicates the bug below may have
|
|
47
|
+
left, and an index with a sortable text or untokenized field needs it anyway: such a
|
|
48
|
+
field gets two extra columns, which changes the schema, so that index starts empty (and
|
|
49
|
+
`needs_reindex` is `True`).
|
|
50
|
+
|
|
51
|
+
### Fixed
|
|
52
|
+
|
|
53
|
+
- After a restart (or a crash) an update could leave the old version of a document in
|
|
54
|
+
the index next to the new one. A new tantivy writer gives its first operation the
|
|
55
|
+
opstamp of the last commit, which that commit's deletes have too; a merge then took
|
|
56
|
+
such a delete for one it had applied already. The engine now commits once when it
|
|
57
|
+
opens its writer. Duplicates already in an index go with the rebuild.
|
|
58
|
+
|
|
59
|
+
### License
|
|
60
|
+
|
|
61
|
+
- sil is now MIT licensed (was GPLv2), like SWL.
|
|
62
|
+
|
|
63
|
+
### Changed
|
|
64
|
+
|
|
65
|
+
- Sorting on a text or untokenized field is several times faster: tantivy sorts on a
|
|
66
|
+
text column some 30 times slower than on an int column. sil now sorts on the first 8
|
|
67
|
+
bytes of the value as an int, and puts hits with the same first bytes in order itself,
|
|
68
|
+
reading one document per different value (a hash of the value tells which are the
|
|
69
|
+
same). With 50,000 records: a range of years sorted on artist takes 0.7 ms instead
|
|
70
|
+
of 4.4 ms, page 51 of everything sorted on artist 4 ms instead of 185 ms. Where many
|
|
71
|
+
different values share their first 8 bytes, it is as fast as before (tantivy sorts
|
|
72
|
+
those on the text).
|
|
73
|
+
|
|
74
|
+
- The wheel only has the package itself (`sil/`); it used to install `doc/`, `examples/` and
|
|
75
|
+
other directories of the repository into site-packages too.
|
|
76
|
+
- pytest, pytest-asyncio, pytest-xdist and python-multipart are no longer dependencies
|
|
77
|
+
of sil; the test tools moved to `requirements-dev.txt`.
|
|
78
|
+
- `README.md`, `doc/reference.md`, this changelog, `LICENSE`, a pre-push hook
|
|
79
|
+
(flake8, isort, tests). No change in behaviour.
|
|
80
|
+
|
|
81
|
+
## 3.1.0 (2026-11-10)
|
|
82
|
+
|
|
83
|
+
**Rebuild indexes with int fields after upgrading**: int fields are fast fields now,
|
|
84
|
+
which changes the schema; an existing index with int fields starts empty (and
|
|
85
|
+
`needs_reindex` is `True`).
|
|
86
|
+
|
|
87
|
+
### Added
|
|
88
|
+
|
|
89
|
+
- `Index.deferred_commit()`: many changes of an immediate-commit index, one commit at the
|
|
90
|
+
end of the block.
|
|
91
|
+
|
|
92
|
+
### Changed
|
|
93
|
+
|
|
94
|
+
- A range query on an int field reads the fast field's column (about 0.6 ms instead of
|
|
95
|
+
16 ms for 120,000 documents).
|
|
96
|
+
|
|
97
|
+
## 3.0.1 (2026-10-30)
|
|
98
|
+
|
|
99
|
+
### Changed
|
|
100
|
+
|
|
101
|
+
- The tantivy writer is opened at the first change, not when the index is opened: an
|
|
102
|
+
index that is only searched costs little memory.
|
|
103
|
+
- The search limit is capped at the number of documents.
|
|
104
|
+
|
|
105
|
+
## 3.0.0 (2026-10-30)
|
|
106
|
+
|
|
107
|
+
Lucene (through JCC and a JVM) is replaced by tantivy. No JVM, no `LD_LIBRARY_PATH`, no
|
|
108
|
+
Lucene build.
|
|
109
|
+
|
|
110
|
+
### Breaking changes
|
|
111
|
+
|
|
112
|
+
- An existing Lucene index cannot be read: rebuild the indexes.
|
|
113
|
+
- The field types are `IndexField.untokenized`, `.text`, `.int` and `.unqualified`
|
|
114
|
+
(instead of Lucene's field classes).
|
|
115
|
+
- Build queries with `Index.term_query` and `Index.all_of` instead of Lucene queries.
|
|
116
|
+
- Drilldown values with equal counts are ordered alphabetically.
|
|
117
|
+
|
|
118
|
+
## 2.x and before
|
|
119
|
+
|
|
120
|
+
Lucene-based; see the git history.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# sil – Seecr Indexing Lib
|
|
2
|
+
|
|
3
|
+
A search index on tantivy (it replaced Lucene in 3.0): index profile, forgiving query
|
|
4
|
+
language, multi-field sorting, drilldown, suggestions, timer commits. Used by swindl
|
|
5
|
+
(one `Index` per model). MIT licensed. Maintained by Seecr (Johan Jonkers, Thijs Janssen).
|
|
6
|
+
`doc/reference.md` is the user-facing reference; keep it in step with the code.
|
|
7
|
+
|
|
8
|
+
## Layout
|
|
9
|
+
|
|
10
|
+
- `sil/index.py` – `Index` (add/delete/commit/search/suggest, sorting, the query
|
|
11
|
+
language), `Hit`, `Query`
|
|
12
|
+
- `sil/indexfield.py` – `IndexField` (untokenized, text, int, unqualified; stored,
|
|
13
|
+
sortable, drilldown, hierarchical, ascii_folding, suggest) and how each adds itself to the tantivy
|
|
14
|
+
schema
|
|
15
|
+
- `sil/indexprofile.py` – `IndexProfile` (the fields of an index)
|
|
16
|
+
- `sil/engine.py` – `Engine`: the tantivy index with its one writer (lazy, behind a lock)
|
|
17
|
+
- `sil/drilldown.py` – counts per value (terms aggregation on a fast field); a tree for a
|
|
18
|
+
hierarchical field (every level is a term, joined by `\x1f` in the facet column)
|
|
19
|
+
- `sil/cql.py` – CQL: own parser (cqlparser's precedence: OR weakest) to a tree of
|
|
20
|
+
`SearchClause`/`Boolean`, `Translator` to tantivy queries as meresco-lucene did
|
|
21
|
+
- `sil/suggester.py` – `Suggester`: its own small tantivy index per suggest field
|
|
22
|
+
- `sil/commit.py` – `Commit`: commits targets, as an asyncio timer task or on demand
|
|
23
|
+
|
|
24
|
+
## Commands
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
pytest sil # the tests
|
|
28
|
+
flake8 sil && isort --check-only sil
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
`env/` is the virtualenv (see the seecr-python rebuild-venv skill); the dev tools
|
|
32
|
+
(flake8, isort, pytest) are the `dev` dependency group in `pyproject.toml`:
|
|
33
|
+
`env/bin/pip install -e . --group dev`.
|
|
34
|
+
|
|
35
|
+
On PyPI the distribution is `seecr-sil` (`sil` was taken); the package and import stay
|
|
36
|
+
`sil`.
|
|
37
|
+
|
|
38
|
+
Releasing: give the version a `## X.Y.Z (date)` section in `CHANGELOG.md`, then push
|
|
39
|
+
the tag `X.Y.Z` to GitHub; `.github/workflows/publish.yml` builds it, uploads it to
|
|
40
|
+
PyPI (trusted publishing) and makes the GitHub release. The tag is the version
|
|
41
|
+
(setuptools-scm).
|
|
42
|
+
|
|
43
|
+
## Design decisions (deliberate, don't re-propose)
|
|
44
|
+
|
|
45
|
+
- tantivy, in process. No Java, no separate query server over HTTP.
|
|
46
|
+
- A changed profile (schema) recreates the index empty and sets `needs_reindex`; sil
|
|
47
|
+
never rebuilds from data itself (it has none: the application does that).
|
|
48
|
+
- Invalid query syntax is searched literally: a search box never raises.
|
|
49
|
+
CQL (`cql_query`) is the exception: it is for APIs (SRU), and raises `CqlError`.
|
|
50
|
+
- Ordering ties (equal scores, equal sort values, `*`) by insertion order (`__seq__`),
|
|
51
|
+
as Lucene did; paging must be stable.
|
|
52
|
+
- tantivy keeps only a tokenizer's name in the schema: `Engine` registers sil's own
|
|
53
|
+
(`FOLDING_TEXT_TOKENIZER`) every time it opens an index; query analysis (CQL,
|
|
54
|
+
prefixes) uses the field's analyzer from `indexfield.py`, which must match it.
|
|
55
|
+
- The writer is opened at the first change (each tantivy writer runs threads).
|
|
56
|
+
|
|
57
|
+
## Invariants to keep
|
|
58
|
+
|
|
59
|
+
- An update is a delete followed by an add of the same record id; `None` values are
|
|
60
|
+
ignored.
|
|
61
|
+
- `__id__` is always stored; it is the record id (swindl adds the object id after it).
|
|
62
|
+
- `Engine._get_writer` commits once right after opening the writer: without it a
|
|
63
|
+
tantivy writer's first operation gets the last commit's opstamp, and a merge can
|
|
64
|
+
undo that delete (duplicates after a restart; `engine_test.py`). Keep it.
|
|
65
|
+
- Searches use a snapshot (`Engine.searcher()`); the reader is reloaded explicitly after
|
|
66
|
+
a commit, so a search right after a commit sees it.
|
|
67
|
+
- A sortable text/untokenized field has `sort_<name>` (the value), `sortprefix_<name>`
|
|
68
|
+
(first 8 UTF-8 bytes as an order-preserving i64) and `sorthash_<name>` (blake2b, 8
|
|
69
|
+
bytes). `_sorted_hits` orders on the prefix; hits with the same prefix are ordered on
|
|
70
|
+
the value in Python (`_same_prefix`, `_whole_value`: one document read per different
|
|
71
|
+
hash), or by tantivy on the text when the group is too large (`PREFIX_GROUP*`).
|
|
72
|
+
- Int fields are fast fields (range queries); changing a field's options changes the
|
|
73
|
+
schema and needs a reindex: announce it in the CHANGELOG.
|
|
74
|
+
|
|
75
|
+
## Conventions
|
|
76
|
+
|
|
77
|
+
- Every source file starts with the license header (copy it from `sil/index.py`).
|
|
78
|
+
- Code style: black, isort with the black profile (`pyproject.toml`), flake8 (`.flake8`);
|
|
79
|
+
lines up to 88.
|
|
80
|
+
- Before every push: flake8, isort and the tests must pass. The pre-push hook
|
|
81
|
+
(`.githooks/pre-push`, on with `git config core.hooksPath .githooks`) runs them.
|
|
82
|
+
- Tests live next to the code (`*_test.py`), plain pytest functions, `tmp_path`.
|
|
83
|
+
- Python >= 3.11. Versions come from git tags via `setuptools_scm`. Don't tag or push
|
|
84
|
+
unless asked.
|
seecr_sil-3.4.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 Seecr (Seek You Too B.V.) https://seecr.nl
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
seecr_sil-3.4.0/PKG-INFO
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: seecr-sil
|
|
3
|
+
Version: 3.4.0
|
|
4
|
+
Summary: Seecr Indexing Lib: search, sorting, drilldown and suggestions on tantivy
|
|
5
|
+
Author-email: Thijs Janssen <thijs@seecr.nl>, Johan Jonkers <johan@seecr.nl>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Documentation, https://github.com/seecr/sil/blob/master/doc/reference.md
|
|
8
|
+
Project-URL: Source, https://github.com/seecr/sil
|
|
9
|
+
Project-URL: Issues, https://github.com/seecr/sil/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/seecr/sil/blob/master/CHANGELOG.md
|
|
11
|
+
Keywords: search,index,full-text,tantivy,drilldown,facets,cql,seecr
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Operating System :: POSIX
|
|
20
|
+
Classifier: Intended Audience :: Developers
|
|
21
|
+
Classifier: Topic :: Database
|
|
22
|
+
Classifier: Topic :: Text Processing :: Indexing
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Requires-Python: >=3.11
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: tantivy<0.28,>=0.27.0
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# sil – Seecr Indexing Lib
|
|
31
|
+
|
|
32
|
+
A search index for Python applications, on [tantivy](https://github.com/quickwit-oss/tantivy):
|
|
33
|
+
an index profile in Python, a forgiving query language, sorting on several fields,
|
|
34
|
+
drilldown (counts per value), suggestions while typing, and commits on a timer. One index
|
|
35
|
+
is one directory; no server, no JVM.
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from sil.index import Index
|
|
39
|
+
from sil.indexfield import IndexField
|
|
40
|
+
from sil.indexprofile import IndexProfile
|
|
41
|
+
|
|
42
|
+
index = Index(path, IndexProfile([
|
|
43
|
+
IndexField.unqualified("all"),
|
|
44
|
+
IndexField.untokenized("genre", drilldown=True),
|
|
45
|
+
IndexField.int("year", sortable=True),
|
|
46
|
+
]), immediate_commit=True)
|
|
47
|
+
|
|
48
|
+
index.add_record("book-1", {"all": "Dune Frank Herbert", "genre": "sf", "year": 1965})
|
|
49
|
+
index.search_query("dune", sort="year", drilldown=[{"name": "genre"}])
|
|
50
|
+
# {"count": 1, "docs": [{"__id__": "book-1"}], "drilldown": {"genre": [("sf", 1)]}}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Install with `pip install seecr-sil` (the package is `sil`). It needs Python 3.11 or
|
|
54
|
+
newer and tantivy.
|
|
55
|
+
|
|
56
|
+
The [reference](https://github.com/seecr/sil/blob/master/doc/reference.md) describes
|
|
57
|
+
everything; the [changelog](https://github.com/seecr/sil/blob/master/CHANGELOG.md) says
|
|
58
|
+
what changed. sil was built on Lucene (through JCC) up to 2.x; 3.0 replaced it with
|
|
59
|
+
tantivy.
|
|
60
|
+
|
|
61
|
+
MIT licensed, see [LICENSE](https://github.com/seecr/sil/blob/master/LICENSE). By
|
|
62
|
+
[Seecr](https://seecr.nl).
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# sil – Seecr Indexing Lib
|
|
2
|
+
|
|
3
|
+
A search index for Python applications, on [tantivy](https://github.com/quickwit-oss/tantivy):
|
|
4
|
+
an index profile in Python, a forgiving query language, sorting on several fields,
|
|
5
|
+
drilldown (counts per value), suggestions while typing, and commits on a timer. One index
|
|
6
|
+
is one directory; no server, no JVM.
|
|
7
|
+
|
|
8
|
+
```python
|
|
9
|
+
from sil.index import Index
|
|
10
|
+
from sil.indexfield import IndexField
|
|
11
|
+
from sil.indexprofile import IndexProfile
|
|
12
|
+
|
|
13
|
+
index = Index(path, IndexProfile([
|
|
14
|
+
IndexField.unqualified("all"),
|
|
15
|
+
IndexField.untokenized("genre", drilldown=True),
|
|
16
|
+
IndexField.int("year", sortable=True),
|
|
17
|
+
]), immediate_commit=True)
|
|
18
|
+
|
|
19
|
+
index.add_record("book-1", {"all": "Dune Frank Herbert", "genre": "sf", "year": 1965})
|
|
20
|
+
index.search_query("dune", sort="year", drilldown=[{"name": "genre"}])
|
|
21
|
+
# {"count": 1, "docs": [{"__id__": "book-1"}], "drilldown": {"genre": [("sf", 1)]}}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Install with `pip install seecr-sil` (the package is `sil`). It needs Python 3.11 or
|
|
25
|
+
newer and tantivy.
|
|
26
|
+
|
|
27
|
+
The [reference](https://github.com/seecr/sil/blob/master/doc/reference.md) describes
|
|
28
|
+
everything; the [changelog](https://github.com/seecr/sil/blob/master/CHANGELOG.md) says
|
|
29
|
+
what changed. sil was built on Lucene (through JCC) up to 2.x; 3.0 replaced it with
|
|
30
|
+
tantivy.
|
|
31
|
+
|
|
32
|
+
MIT licensed, see [LICENSE](https://github.com/seecr/sil/blob/master/LICENSE). By
|
|
33
|
+
[Seecr](https://seecr.nl).
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Security
|
|
2
|
+
|
|
3
|
+
sil indexes your data and parses the queries of your users, so we take security problems
|
|
4
|
+
seriously.
|
|
5
|
+
|
|
6
|
+
## Reporting a problem
|
|
7
|
+
|
|
8
|
+
Please don't report security problems in a public issue. Instead, use
|
|
9
|
+
[private vulnerability reporting](https://github.com/seecr/sil/security/advisories/new)
|
|
10
|
+
on GitHub. Tell us what you found, which version of sil it affects, and how to
|
|
11
|
+
reproduce it.
|
|
12
|
+
|
|
13
|
+
We will confirm that we received your report, keep you informed while we work on a fix,
|
|
14
|
+
and credit you in the release notes unless you prefer not to be named.
|
|
15
|
+
|
|
16
|
+
## Supported versions
|
|
17
|
+
|
|
18
|
+
Security fixes go into the latest release. Upgrade to the newest version on
|
|
19
|
+
[PyPI](https://pypi.org/project/seecr-sil/) to get them.
|