Commit Graph

11306 Commits

Author SHA1 Message Date
Trenton H acdee63197 Call to_html on snippets. JSON fields don't support snippets, so store a 'notes_text' to highlight instead. Use tantivty score when sorting for that, instead of discarding it 2026-04-08 15:05:04 -07:00
Trenton H 759717404e Adds notes for where we can improve, if either fixes, features or a new release drop in from Tantivy 2026-04-07 14:45:27 -07:00
Trenton H 0bdaff203c Fixes copilot found issues, try to tune the filtering as suggested 2026-04-07 13:30:35 -07:00
Trenton H 689f5964fc Merge branch 'dev' into feature-search-pagination-improvements 2026-04-07 08:06:35 -07:00
Trenton H a5fe88d2a1 Chore: Resolves some zizmor reported code scan findings (#12516)
Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
2026-04-06 23:03:29 +00:00
Trenton H a0e5ab1d12 Removes the profiling data 2026-04-06 15:57:46 -07:00
GitHub Actions 51c59746a7 Auto translate strings 2026-04-06 22:51:57 +00:00
Trenton H c232d443fa Breaking: Decouple OCR control from archive file control (#12448)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
2026-04-06 15:50:21 -07:00
Trenton Holmes 51624840f2 docs: note autocomplete as candidate for Redis caching
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 14:33:45 -07:00
Trenton Holmes 48309938c6 perf: use prefix query in autocomplete to avoid full-index scan
Previously autocomplete scanned every visible document to extract
words, then filtered by prefix in Python. Now builds a regex query
on autocomplete_word so Tantivy only returns docs containing matching
words. At 5k docs: rare prefixes go from 335ms to <1ms, common
prefixes from 342ms to 199ms with 58-99% less peak memory.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 14:26:26 -07:00
Trenton Holmes b4cfc27876 docs: note potential large IN clause in selection_data query
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 13:52:41 -07:00
Trenton Holmes 86ac3ba9f1 fix: limit global search to 9 IDs and fix more_like_this_ids off-by-one
Global search only displays 3 results but was fetching all matching IDs
and hydrating them via in_bulk. Now passes limit=9 to search_ids().

more_like_this_ids could return limit-1 results when the original doc
appeared in the result set. Now fetches limit+1 and slices after
filtering.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 13:49:23 -07:00
Trenton Holmes 67261287d2 refactor: extract nested helpers in UnifiedSearchViewSet.list()
Break the monolithic list() method into typed sub-functions for
readability: parse_search_params, intersect_and_order, run_text_search,
run_more_like_this. Also defer get_backend() until after param
validation so invalid requests fail fast.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 13:31:36 -07:00
Trenton Holmes ca077ba1e3 fix: reuse notes snippet generator across docs in highlight_hits()
The notes SnippetGenerator was being recreated per document instead of
lazily initialized once like the content generator.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 13:23:14 -07:00
Trenton Holmes e3076b8d62 refactor: remove dead search() method and SearchResults from TantivyBackend
All production callers now use search_ids() + highlight_hits(). Migrated
10 tests to search_ids(), removed 5 that tested search()-specific
features (score normalization, highlight windowing).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 13:21:01 -07:00
Trenton Holmes cb851fc217 refactor: switch global search from backend.search() to search_ids()
The global search endpoint only needs document IDs (takes top 3), not
highlights or scores. Using search_ids() avoids building SearchHit dicts
and removes the last production caller of backend.search().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 13:14:21 -07:00
Trenton Holmes 534fcfde6b refactor: remove dead more_like_this() method from TantivyBackend
The method is no longer called anywhere in production code — all callers
were migrated to more_like_this_ids() during the search pagination work.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 13:10:58 -07:00
Trenton Holmes 0b90f15602 docs: update plan with profiling results and final architecture
Fill in TBD profiling table with actual before/after numbers,
update post-implementation notes to reflect the search_ids +
highlight_hits architecture, and add post-option1 profiling data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 13:05:29 -07:00
Trenton Holmes 0b5b6fdad5 refactor: extract _parse_query and _apply_permission_filter helpers
Deduplicates query parsing (3 call sites) and permission filter
wrapping (4 call sites) into private helper methods on TantivyBackend.
Also documents the N-lookup limitation of highlight_hits().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 13:31:37 -07:00
Trenton Holmes d98dbd50f4 fix: address code review findings (int keys, docstring, empty ordering)
- TantivyRelevanceList.__getitem__ now handles int keys, not just slices
- search_ids() docstring corrected ("no highlights or scores")
- Empty ordering param now correctly becomes None instead of ""

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 13:26:10 -07:00
Trenton Holmes 7649e4a6b1 Merge remote-tracking branch 'origin/dev' into feature-search-pagination-improvements 2026-04-05 13:18:43 -07:00
Trenton Holmes 610ba27891 feat: replace 10000 overfetch with search_ids + page-only highlights
Use search_ids() for the full set of matching IDs (lightweight ints,
no arbitrary cap) and highlight_hits() for just the displayed page.
TantivyRelevanceList now holds ordered IDs for count/selection_data
and a small page of rich SearchHit dicts for serialization.

Removes the hardcoded 10000 limit that silently truncated results
for large collections. Memory usage down ~10% on sorted/paginated
search paths at 200 docs, with larger gains expected at scale.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-05 12:54:47 -07:00
shamoon a945cd9379 Security: add static analysis CI workflow (#12466) 2026-04-04 04:17:23 +00:00
Trenton H 5f5fb263c9 Fix: Don't create a new note highlight generator per note in the loop (#12512) 2026-04-03 17:34:15 -07:00
Trenton Holmes 7c50e0077c chore: remove temporary profiling infrastructure
Profiling tests and helper served their purpose during the search
performance optimization work. Baseline and post-implementation
data captured in docs/superpowers/plans/.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 15:53:55 -07:00
Trenton Holmes 288740ea62 refactor: promote sort_field_map to class-level constant on TantivyBackend
Single source of truth for sort field mapping. The viewset now references
TantivyBackend.SORTABLE_FIELDS instead of maintaining a duplicate set.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 15:53:49 -07:00
shamoon c039df423f Documentation: note required secret key in v3 guide (#12513) 2026-04-03 15:41:38 -07:00
Trenton Holmes d998d3fbaf feat: delegate sorting to Tantivy and use page-only highlights in viewset
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 15:35:14 -07:00
Trenton Holmes 6cf01dd383 feat: add search_ids() and more_like_this_ids() lightweight methods
search_ids() returns only document IDs matching a query — no highlights,
no SearchHit objects. more_like_this_ids() does the same for MLT queries.
These provide lightweight paths when only IDs are needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 15:21:52 -07:00
Trenton Holmes 0d915c58a4 feat: add highlight_page/highlight_page_size params to search()
Gate expensive snippet/highlight generation to only the requested
slice of hits, allowing the viewset to avoid generating highlights
for all 10k results when only 25 are displayed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 15:10:00 -07:00
Trenton Holmes 46008d2da7 test: add baseline profiling tests for search performance
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 14:58:11 -07:00
shamoon b807b107ad Enhancement: include sharelinks + bundles in export/import (#12479) 2026-04-03 21:51:57 +00:00
Trenton Holmes 6768c1e6f8 updated plan 2026-04-03 14:43:44 -07:00
Trenton Holmes 5a94291b79 Initial plan 2026-04-03 14:35:19 -07:00
Trenton H c2f02851da Chore: Better typed status manager messages (#12509) 2026-04-03 21:18:01 +00:00
GitHub Actions d0f8a98a9a Auto translate strings 2026-04-03 20:55:14 +00:00
shamoon 566afdffca Enhancement: unify text search to use tantivy (#12485) 2026-04-03 13:53:45 -07:00
Trenton H f32ad98d8e Feature: Update consumer logging to include task ID for log correlation (#12510) 2026-04-03 13:31:40 -07:00
dependabot[bot] 64debc87a5 Chore(deps): Bump djangorestframework in the django-ecosystem group (#12488)
Bumps the django-ecosystem group with 1 update: [djangorestframework](https://github.com/encode/django-rest-framework).


Updates `djangorestframework` from 3.16.1 to 3.17.1
- [Release notes](https://github.com/encode/django-rest-framework/releases)
- [Commits](https://github.com/encode/django-rest-framework/compare/3.16.1...3.17.1)

---
updated-dependencies:
- dependency-name: djangorestframework
  dependency-version: 3.17.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: django-ecosystem
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-03 08:16:36 -07:00
dependabot[bot] eb758862c9 Chore(deps): Bump the document-processing group with 3 updates (#12489)
Bumps the document-processing group with 3 updates: [gotenberg-client](https://github.com/stumpylog/gotenberg-client), [ocrmypdf](https://github.com/ocrmypdf/OCRmyPDF) and [tika-client](https://github.com/stumpylog/tika-client).


Updates `gotenberg-client` from 0.13.1 to 0.14.0
- [Release notes](https://github.com/stumpylog/gotenberg-client/releases)
- [Changelog](https://github.com/stumpylog/gotenberg-client/blob/main/CHANGELOG.md)
- [Commits](https://github.com/stumpylog/gotenberg-client/compare/0.13.1...0.14.0)

Updates `ocrmypdf` from 17.3.0 to 17.4.0
- [Release notes](https://github.com/ocrmypdf/OCRmyPDF/releases)
- [Commits](https://github.com/ocrmypdf/OCRmyPDF/compare/v17.3.0...v17.4.0)

Updates `tika-client` from 0.10.0 to 0.11.0
- [Release notes](https://github.com/stumpylog/tika-client/releases)
- [Changelog](https://github.com/stumpylog/tika-client/blob/main/CHANGELOG.md)
- [Commits](https://github.com/stumpylog/tika-client/compare/0.10.0...0.11.0)

---
updated-dependencies:
- dependency-name: gotenberg-client
  dependency-version: 0.14.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: document-processing
- dependency-name: ocrmypdf
  dependency-version: 17.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: document-processing
- dependency-name: tika-client
  dependency-version: 0.11.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: document-processing
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-03 07:22:04 -07:00
dependabot[bot] 8c539bd862 Chore(deps): Bump the utilities-patch group across 1 directory with 5 updates (#12499)
Bumps the utilities-patch group with 5 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [llama-index-core](https://github.com/run-llama/llama_index) | `0.14.16` | `0.14.19` |
| [nltk](https://github.com/nltk/nltk) | `3.9.3` | `3.9.4` |
| [zensical](https://github.com/zensical/zensical) | `0.0.26` | `0.0.29` |
| [prek](https://github.com/j178/prek) | `0.3.5` | `0.3.8` |
| [ruff](https://github.com/astral-sh/ruff) | `0.15.5` | `0.15.7` |



Updates `llama-index-core` from 0.14.16 to 0.14.19
- [Release notes](https://github.com/run-llama/llama_index/releases)
- [Changelog](https://github.com/run-llama/llama_index/blob/main/CHANGELOG.md)
- [Commits](https://github.com/run-llama/llama_index/compare/v0.14.16...v0.14.19)

Updates `nltk` from 3.9.3 to 3.9.4
- [Changelog](https://github.com/nltk/nltk/blob/develop/ChangeLog)
- [Commits](https://github.com/nltk/nltk/compare/3.9.3...3.9.4)

Updates `zensical` from 0.0.26 to 0.0.29
- [Release notes](https://github.com/zensical/zensical/releases)
- [Commits](https://github.com/zensical/zensical/compare/v0.0.26...v0.0.29)

Updates `prek` from 0.3.5 to 0.3.8
- [Release notes](https://github.com/j178/prek/releases)
- [Changelog](https://github.com/j178/prek/blob/master/CHANGELOG.md)
- [Commits](https://github.com/j178/prek/compare/v0.3.5...v0.3.8)

Updates `ruff` from 0.15.5 to 0.15.7
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.15.5...0.15.7)

---
updated-dependencies:
- dependency-name: llama-index-core
  dependency-version: 0.14.19
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: utilities-patch
- dependency-name: nltk
  dependency-version: 3.9.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: utilities-patch
- dependency-name: zensical
  dependency-version: 0.0.29
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: utilities-patch
- dependency-name: prek
  dependency-version: 0.3.8
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: utilities-patch
- dependency-name: ruff
  dependency-version: 0.15.7
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: utilities-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-03 13:25:17 +00:00
Trenton H d365f19962 Security: Registers a custom serializer which signs the task payload (#12504) 2026-04-03 03:49:54 +00:00
GitHub Actions 2703c12f1a Auto translate strings 2026-04-03 03:25:57 +00:00
shamoon e7c7978d67 Enhancement: allow opt-in blocking internal mail hosts (#12502) 2026-04-03 03:24:28 +00:00
GitHub Actions 83501757df Auto translate strings 2026-04-02 22:36:32 +00:00
Trenton H dda05a7c00 Security: Improve overall security in a few ways (#12501)
- Make sure we're always using regex with timeouts for user controlled data
- Adds rate limiting to the token endpoint (configurable)
- Signs the classifier pickle file with the SECRET_KEY and refuse to load one which doesn't verify.
- Require the user to set a secret key, instead of falling back to our old hard coded one
2026-04-02 15:30:26 -07:00
Trenton H 376af81b9c Fix: Resolve another TC assuming an object has been created somewhere (#12503) 2026-04-02 14:58:28 -07:00
GitHub Actions 05c9e21fac Auto translate strings 2026-04-02 19:40:05 +00:00
Trenton H aed9abe48c Feature: Replace Whoosh with tantivy search backend (#12471)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Antoine Mérino <3023499+Merinorus@users.noreply.github.com>
2026-04-02 12:38:22 -07:00
dependabot[bot] e01a762e81 Chore(deps): Bump aiohttp in the uv group across 1 directory (#12486)
---
updated-dependencies:
- dependency-name: aiohttp
  dependency-version: 3.13.4
  dependency-type: indirect
  dependency-group: uv
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-02 10:13:19 -07:00