This commit is contained in:
parent
8ecb963be4
commit
533cf96dce
1 changed files with 5 additions and 5 deletions
10
handlers.py
10
handlers.py
|
|
@ -210,7 +210,7 @@ def handle_search(query):
|
||||||
# Hybrid search: merge BM25 + semantic via RRF
|
# Hybrid search: merge BM25 + semantic via RRF
|
||||||
bm25_ids = [r["id"] for r in bm25_rows]
|
bm25_ids = [r["id"] for r in bm25_rows]
|
||||||
chunk_snippets = {} # page_id -> best chunk text
|
chunk_snippets = {} # page_id -> best chunk text
|
||||||
if get_setting("semantic_search", "1") == "1":
|
if get_setting("semantic_search", "0") == "1":
|
||||||
try:
|
try:
|
||||||
from embeddings import hybrid_search
|
from embeddings import hybrid_search
|
||||||
use_reranker = get_setting("use_reranker", "1") == "1"
|
use_reranker = get_setting("use_reranker", "1") == "1"
|
||||||
|
|
@ -468,7 +468,7 @@ def handle_add_manual_submit(body):
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
# Generate embeddings for this page (if semantic search is enabled)
|
# Generate embeddings for this page (if semantic search is enabled)
|
||||||
if get_setting("semantic_search", "1") == "1":
|
if get_setting("semantic_search", "0") == "1":
|
||||||
try:
|
try:
|
||||||
from embeddings import store_embeddings
|
from embeddings import store_embeddings
|
||||||
# Pass the page_id, title, description, and db connection
|
# Pass the page_id, title, description, and db connection
|
||||||
|
|
@ -1219,7 +1219,7 @@ def handle_subscription_sync(sub_id):
|
||||||
(sub_id, s["url"], s["title"], s.get("note", ""), tags_str),
|
(sub_id, s["url"], s["title"], s.get("note", ""), tags_str),
|
||||||
)
|
)
|
||||||
# Embed remote page for semantic search
|
# Embed remote page for semantic search
|
||||||
if get_setting("semantic_search", "1") == "1":
|
if get_setting("semantic_search", "0") == "1":
|
||||||
try:
|
try:
|
||||||
from embeddings import store_remote_embeddings
|
from embeddings import store_remote_embeddings
|
||||||
rp_id = db.execute(
|
rp_id = db.execute(
|
||||||
|
|
@ -1295,7 +1295,7 @@ def handle_subscription_syncall():
|
||||||
"ON CONFLICT(subscription_id, url) DO UPDATE SET title=excluded.title, note=excluded.note, tags=excluded.tags",
|
"ON CONFLICT(subscription_id, url) DO UPDATE SET title=excluded.title, note=excluded.note, tags=excluded.tags",
|
||||||
(sub["id"], s["url"], s["title"], s.get("note", ""), tags_str),
|
(sub["id"], s["url"], s["title"], s.get("note", ""), tags_str),
|
||||||
)
|
)
|
||||||
if get_setting("semantic_search", "1") == "1":
|
if get_setting("semantic_search", "0") == "1":
|
||||||
try:
|
try:
|
||||||
from embeddings import store_remote_embeddings
|
from embeddings import store_remote_embeddings
|
||||||
rp_id = db.execute(
|
rp_id = db.execute(
|
||||||
|
|
@ -1325,7 +1325,7 @@ _reindex_thread = None
|
||||||
|
|
||||||
|
|
||||||
def handle_reindex_form():
|
def handle_reindex_form():
|
||||||
if get_setting("semantic_search", "1") != "1":
|
if get_setting("semantic_search", "0") != "1":
|
||||||
return _respond(
|
return _respond(
|
||||||
f"<h2>semantic search index</h2>"
|
f"<h2>semantic search index</h2>"
|
||||||
f"<p>Semantic search is disabled. Enable it in <a href=\"/style\">settings</a> to use embeddings.</p>"
|
f"<p>Semantic search is disabled. Enable it in <a href=\"/style\">settings</a> to use embeddings.</p>"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue