Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
192 changes: 192 additions & 0 deletions bin/boost
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
#!/usr/bin/env python3
"""
Script to add search boost values to markdown files listed in mkdocs.yml nav.

- Files in "Using AxonOps" section get boost: 8
- Files in "Data Platforms" section get boost: 3
- All other nav files get boost: 5
"""

import os
import re
import sys
import yaml

# Custom loader that ignores Python-specific tags in mkdocs.yml
class SafeLineLoader(yaml.SafeLoader):
pass

def ignore_unknown(loader, tag_suffix, node):
"""Ignore unknown tags and return None."""
return None

SafeLineLoader.add_multi_constructor('tag:yaml.org,2002:python/', ignore_unknown)

SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
REPO_ROOT = os.path.dirname(SCRIPT_DIR)
MKDOCS_PATH = os.path.join(REPO_ROOT, 'mkdocs.yml')
DOCS_DIR = os.path.join(REPO_ROOT, 'docs')


def extract_md_files(nav, section=None):
"""
Recursively extract markdown files from nav structure.
Returns list of tuples: (file_path, boost_value)
"""
files = []

if isinstance(nav, list):
for item in nav:
files.extend(extract_md_files(item, section))
elif isinstance(nav, dict):
for key, value in nav.items():
# Determine which section we're in
if key == 'Using AxonOps':
current_section = 'using_axonops'
elif key == 'Data Platforms':
current_section = 'data_platforms'
else:
current_section = section # Inherit parent section

if isinstance(value, str) and value.endswith('.md'):
boost = get_boost_for_section(current_section)
files.append((value, boost))
else:
files.extend(extract_md_files(value, current_section))
elif isinstance(nav, str) and nav.endswith('.md'):
boost = get_boost_for_section(section)
files.append((nav, boost))

return files


def get_boost_for_section(section):
"""Return boost value based on section."""
if section == 'using_axonops':
return 8
elif section == 'data_platforms':
return 3
else:
return 5


def update_front_matter(file_path, boost):
"""
Update or add search boost to file's front matter.
Preserves existing front matter formatting exactly.
Skips files with boost values of 10 or 0.1 (manually set).
"""
full_path = os.path.join(DOCS_DIR, file_path)

if not os.path.exists(full_path):
print(f" WARNING: File not found: {file_path}")
return 'error'

with open(full_path, 'r', encoding='utf-8') as f:
content = f.read()

# Check if file has front matter
front_matter_pattern = re.compile(r'^(---\s*\n)(.*?)(\n---\s*\n)', re.DOTALL)
match = front_matter_pattern.match(content)

# Check for existing boost value that should be preserved
if match:
front_matter_text = match.group(2)
existing_boost = re.search(r'^\s+boost:\s*([\d.]+)', front_matter_text, re.MULTILINE)
if existing_boost:
val = float(existing_boost.group(1))
if val == 10 or val == 0.1:
return 'skipped'

if match:
opening = match.group(1)
front_matter_text = match.group(2)
closing = match.group(3)
rest_of_content = content[match.end():]

# Check if search section exists
search_pattern = re.compile(r'^search:\s*$', re.MULTILINE)
search_match = search_pattern.search(front_matter_text)

if search_match:
# search: section exists, check for boost
boost_pattern = re.compile(r'^( boost:\s*)(\d+)\s*$', re.MULTILINE)
boost_match = boost_pattern.search(front_matter_text)

if boost_match:
# Update existing boost value
new_front_matter = front_matter_text[:boost_match.start(2)] + str(boost) + front_matter_text[boost_match.end(2):]
else:
# Add boost under existing search section
# Find where search: line ends and insert boost after it
search_line_end = front_matter_text.find('\n', search_match.start())
if search_line_end == -1:
search_line_end = len(front_matter_text)
new_front_matter = front_matter_text[:search_line_end] + f'\n boost: {boost}' + front_matter_text[search_line_end:]
else:
# No search section, add it at the end
new_front_matter = front_matter_text.rstrip() + f'\nsearch:\n boost: {boost}'

new_content = opening + new_front_matter + closing + rest_of_content
else:
# No front matter exists, add it
new_content = f'---\nsearch:\n boost: {boost}\n---\n{content}'

with open(full_path, 'w', encoding='utf-8') as f:
f.write(new_content)

return 'updated'


def main():
# Load mkdocs.yml
if not os.path.exists(MKDOCS_PATH):
print(f"Error: mkdocs.yml not found at {MKDOCS_PATH}")
sys.exit(1)

with open(MKDOCS_PATH, 'r', encoding='utf-8') as f:
mkdocs_config = yaml.load(f, Loader=SafeLineLoader)

nav = mkdocs_config.get('nav', [])
if not nav:
print("Error: No nav section found in mkdocs.yml")
sys.exit(1)

# Extract all markdown files with their boost values
files = extract_md_files(nav)

print(f"Found {len(files)} markdown files in nav")
print()

# Group by boost value for display
boost_8_files = [f for f, b in files if b == 8]
boost_5_files = [f for f, b in files if b == 5]
boost_3_files = [f for f, b in files if b == 3]

print(f"Files with boost 8 (Using AxonOps): {len(boost_8_files)}")
print(f"Files with boost 5 (other sections): {len(boost_5_files)}")
print(f"Files with boost 3 (Data Platforms): {len(boost_3_files)}")
print()

# Update each file
updated = 0
skipped = 0
errors = 0

for file_path, boost in files:
result = update_front_matter(file_path, boost)
if result == 'updated':
print(f" Updating {file_path} (boost: {boost})")
updated += 1
elif result == 'skipped':
print(f" Skipping {file_path} (manual boost preserved)")
skipped += 1
else:
errors += 1

print()
print(f"Done! Updated {updated} files, skipped {skipped} (manual), {errors} errors")


if __name__ == '__main__':
main()
2 changes: 2 additions & 0 deletions docs/authentication/ldap.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: "Configure LDAP authentication for AxonOps. Integrate with Active D
meta:
- name: keywords
content: "LDAP authentication, Active Directory, OpenLDAP, AxonOps login"
search:
boost: 5
---

# LDAP Authentication
Expand Down
2 changes: 2 additions & 0 deletions docs/cluster/cluster-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: "AxonOps cluster overview dashboard. Monitor Cassandra and Kafka cl
meta:
- name: keywords
content: "cluster overview, AxonOps dashboard, cluster health, monitoring"
search:
boost: 8
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: "Common application development mistakes with Cassandra. Driver mis
meta:
- name: keywords
content: "Cassandra anti-patterns, driver mistakes, application errors, production failures"
search:
boost: 3
---

# Application Development Anti-Patterns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: "CQLAI - AI-powered CQL shell for Apache Cassandra. Natural languag
meta:
- name: keywords
content: "CQLAI, AI CQL, Cassandra AI, natural language queries, intelligent shell"
search:
boost: 3
---

# CQLAI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: "Best practices for Cassandra driver usage. Connection pooling, ret
meta:
- name: keywords
content: "Cassandra driver best practices, connection pooling, retry logic, performance"
search:
boost: 3
---

# Driver Best Practices
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: "Cassandra driver connection management. Configure connection pools
meta:
- name: keywords
content: "Cassandra connection management, connection pool, timeouts, keep-alive"
search:
boost: 3
---

# Connection Management
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: "Cassandra drivers overview. Official drivers for Java, Python, Nod
meta:
- name: keywords
content: "Cassandra drivers, Java driver, Python driver, DataStax drivers"
search:
boost: 3
---

# Cassandra Drivers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: "Cassandra driver policies for load balancing, retry logic, reconne
meta:
- name: keywords
content: "Cassandra driver policies, load balancing policy, retry policy"
search:
boost: 3
---

# Driver Policies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: "Cassandra load balancing policies. Configure token-aware, data cen
meta:
- name: keywords
content: "Cassandra load balancing, token-aware, DC-aware, round-robin"
search:
boost: 3
---

# Load Balancing Policy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: "Cassandra reconnection policies. Configure exponential backoff and
meta:
- name: keywords
content: "Cassandra reconnection, exponential backoff, connection retry"
search:
boost: 3
---

# Reconnection Policy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: "Cassandra retry policies. Handle read/write timeouts and unavailab
meta:
- name: keywords
content: "Cassandra retry policy, timeout handling, unavailable exception"
search:
boost: 3
---

# Retry Policy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: "Cassandra speculative execution policy. Reduce tail latencies with
meta:
- name: keywords
content: "speculative execution, Cassandra latency, parallel queries"
search:
boost: 3
---

# Speculative Execution Policy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: "Cassandra prepared statements guide. Optimize performance and prev
meta:
- name: keywords
content: "Cassandra prepared statements, CQL performance, query optimization"
search:
boost: 3
---

# Prepared Statements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: "Cassandra application development guide. Drivers, best practices,
meta:
- name: keywords
content: "Cassandra development, application development, Cassandra drivers"
search:
boost: 3
---

# Application Development
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: "Implementing audit trails and regulatory compliance with Apache Ca
meta:
- name: keywords
content: "Cassandra audit trail, compliance, GDPR, HIPAA, SOX, data retention, consent management"
search:
boost: 3
---

# Audit & Compliance Patterns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: "Implementing Command Query Responsibility Segregation (CQRS) with
meta:
- name: keywords
content: "CQRS Cassandra, command query segregation, read replicas, event sourcing, query optimization"
search:
boost: 3
---

# CQRS Pattern with Cassandra
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: "Implementing digital currencies, loyalty points, and token systems
meta:
- name: keywords
content: "Cassandra digital currency, token system, loyalty points, wallet management, double-spend prevention"
search:
boost: 3
---

# Digital Currency & Token Systems
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: "Implementing digital twins for IoT applications with Apache Cassan
meta:
- name: keywords
content: "Cassandra digital twin, IoT device management, device state, command delivery, edge computing"
search:
boost: 3
---

# Digital Twin Pattern
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: "Architectural patterns for event sourcing with Apache Cassandra. C
meta:
- name: keywords
content: "Cassandra event sourcing, event store, aggregate reconstruction, CQRS, domain events"
search:
boost: 3
---

# Event Sourcing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: "Implementing idempotent operations with Apache Cassandra. Covers i
meta:
- name: keywords
content: "Cassandra idempotency, idempotent operations, deduplication, retry safety, distributed systems"
search:
boost: 3
---

# Idempotency Patterns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: "Architectural patterns for building enterprise applications with A
meta:
- name: keywords
content: "Cassandra patterns, enterprise architecture, CQRS, event sourcing, distributed systems, finance, IoT, healthcare"
search:
boost: 3
---

# Enterprise Application Patterns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: "Implementing financial ledgers with Apache Cassandra. Covers doubl
meta:
- name: keywords
content: "Cassandra ledger, double-entry bookkeeping, financial transactions, immutable log, balance calculation"
search:
boost: 3
---

# Ledger Pattern
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ description: "Implementing multi-tenant architectures with Apache Cassandra. Cov
meta:
- name: keywords
content: "Cassandra multi-tenant, SaaS architecture, tenant isolation, noisy neighbor, resource quotas"
search:
boost: 3
---

# Multi-Tenant Data Isolation
Expand Down
Loading