feat: title weight procedure
All checks were successful
Deploy on push / deploy (push) Successful in 1m16s
All checks were successful
Deploy on push / deploy (push) Successful in 1m16s
This commit is contained in:
parent
e382cc1ea5
commit
27b0928e73
|
@ -254,14 +254,18 @@ class SearchService:
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
# Repeat title 3 times for higher keyword relevance
|
||||||
|
title_repeat = ". ".join(filter(None, [shout.title] * 3))
|
||||||
|
|
||||||
# Combine all text fields
|
# Combine all text fields
|
||||||
text = " ".join(filter(None, [
|
text_parts = [
|
||||||
shout.title or "",
|
title_repeat,
|
||||||
shout.subtitle or "",
|
shout.subtitle or "",
|
||||||
shout.lead or "",
|
shout.lead or "",
|
||||||
shout.body or "",
|
shout.body or "",
|
||||||
shout.media or ""
|
shout.media or ""
|
||||||
]))
|
]
|
||||||
|
text = " ".join(filter(None, text_parts))
|
||||||
|
|
||||||
if not text.strip():
|
if not text.strip():
|
||||||
logger.warning(f"No text content to index for shout {shout.id}")
|
logger.warning(f"No text content to index for shout {shout.id}")
|
||||||
|
@ -305,7 +309,12 @@ class SearchService:
|
||||||
for shout in shouts:
|
for shout in shouts:
|
||||||
try:
|
try:
|
||||||
text_fields = []
|
text_fields = []
|
||||||
for field_name in ['title', 'subtitle', 'lead', 'body']:
|
|
||||||
|
# Repeat title 3 times
|
||||||
|
title_repeat = ". ".join(filter(None, [getattr(shout, "title", None)] * 3))
|
||||||
|
|
||||||
|
text_fields = [title_repeat]
|
||||||
|
for field_name in ['subtitle', 'lead', 'body']:
|
||||||
field_value = getattr(shout, field_name, None)
|
field_value = getattr(shout, field_name, None)
|
||||||
if field_value and isinstance(field_value, str) and field_value.strip():
|
if field_value and isinstance(field_value, str) and field_value.strip():
|
||||||
text_fields.append(field_value.strip())
|
text_fields.append(field_value.strip())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user