mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-04-03 22:58:51 +00:00
Compare commits
3 Commits
dev
...
fix-search
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45906884f3 | ||
|
|
d2f866a532 | ||
|
|
469069b401 |
@@ -532,6 +532,7 @@ class TantivyBackend:
|
|||||||
# Build result hits with highlights
|
# Build result hits with highlights
|
||||||
hits: list[SearchHit] = []
|
hits: list[SearchHit] = []
|
||||||
snippet_generator = None
|
snippet_generator = None
|
||||||
|
notes_snippet_generator = None
|
||||||
|
|
||||||
for rank, (doc_address, score) in enumerate(page_hits, start=offset + 1):
|
for rank, (doc_address, score) in enumerate(page_hits, start=offset + 1):
|
||||||
# Get the actual document from the searcher using the doc address
|
# Get the actual document from the searcher using the doc address
|
||||||
@@ -558,13 +559,16 @@ class TantivyBackend:
|
|||||||
|
|
||||||
# Try notes highlights
|
# Try notes highlights
|
||||||
if "notes" in doc_dict:
|
if "notes" in doc_dict:
|
||||||
notes_generator = tantivy.SnippetGenerator.create(
|
if notes_snippet_generator is None:
|
||||||
searcher,
|
notes_snippet_generator = tantivy.SnippetGenerator.create(
|
||||||
final_query,
|
searcher,
|
||||||
self._schema,
|
final_query,
|
||||||
"notes",
|
self._schema,
|
||||||
|
"notes",
|
||||||
|
)
|
||||||
|
notes_snippet = notes_snippet_generator.snippet_from_doc(
|
||||||
|
actual_doc,
|
||||||
)
|
)
|
||||||
notes_snippet = notes_generator.snippet_from_doc(actual_doc)
|
|
||||||
if notes_snippet:
|
if notes_snippet:
|
||||||
highlights["notes"] = str(notes_snippet)
|
highlights["notes"] = str(notes_snippet)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user