Skip to content

Commit 225542c

Browse files
author
ebembi-crdb
committed
Fix session variable search discoverability in docs
Enhance session variable descriptions with variable names to improve search discoverability. Session variables like default_transaction_use_follower_reads were not findable via search because variable names appeared only in filtered table cells while descriptions lacked the variable names. The fix prepends session variable names to their descriptions for session-variables.html, making them discoverable without creating additional index records. Fixes issue where customers couldn't find documented session variables through main docs search functionality.
1 parent f775435 commit 225542c

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/current/algolia_index_intelligent_bloat_removal.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,30 @@ def get_git_last_modified(file_path: pathlib.Path) -> str:
672672
GIT_DATE_CACHE[cache_key] = date
673673
return date
674674

675+
def enhance_session_variable_content(content: str, element, context: Dict[str, str]) -> str:
676+
"""Add session variable name to description records where missing for better discoverability."""
677+
# Only for session-variables.html page
678+
if 'session-variables.html' not in context.get('url', ''):
679+
return content
680+
681+
# Check if this is a description cell adjacent to a variable name cell
682+
if element.name == 'td':
683+
prev_sibling = element.find_previous_sibling('td')
684+
if prev_sibling:
685+
prev_text = extract_text_with_spaces(prev_sibling).strip()
686+
687+
# If previous cell contains a session variable name pattern
688+
if (re.match(r'^\w+(_\w+)+$', prev_text) and
689+
'_' in prev_text and
690+
len(prev_text) > 5 and
691+
len(prev_text) < 50 and
692+
prev_text not in content):
693+
694+
# Prepend variable name to description for discoverability
695+
return f"{prev_text}: {content}"
696+
697+
return content
698+
675699
def extract_records_from_html(html_path: pathlib.Path, versions: Dict[str, str] = None) -> List[Dict[str, Any]]:
676700
"""Proven extraction + intelligent bloat removal."""
677701
if should_exclude_file(str(html_path), versions):
@@ -738,6 +762,9 @@ def extract_records_from_html(html_path: pathlib.Path, versions: Dict[str, str]
738762
continue
739763

740764
text = extract_text_with_spaces(element)
765+
766+
# Enhance session variable content for better discoverability
767+
text = enhance_session_variable_content(text, element, filter_context)
741768

742769
# INTELLIGENT BLOAT REMOVAL - context-aware filtering
743770
if bloat_filter.is_bloat_content(text, filter_context):

0 commit comments

Comments
 (0)