forked from 0xWheatyz/SPARC
fix(analyzer): route _analyze_company_safe through cache-aware path
_analyze_company_safe was calling SERP.query directly, bypassing the SERP query cache in analyze_company. Now delegates fully to analyze_company() and reads patent_count from the serp_queries cache.
This commit is contained in:
+6
-3
@@ -182,10 +182,13 @@ class CompanyAnalyzer:
|
||||
CompanyAnalysisResult with success/failure status
|
||||
"""
|
||||
try:
|
||||
patents = SERP.query(company_name)
|
||||
patent_count = len(patents.patents) if patents.patents else 0
|
||||
# Delegate to analyze_company which handles SERP/patent caching
|
||||
analysis = self.analyze_company(company_name)
|
||||
|
||||
analysis = self.analyze_company(company_name, patents=patents)
|
||||
# Determine patent count from cached SERP query
|
||||
query_hash = hashlib.sha256(company_name.lower().encode()).hexdigest()
|
||||
cached_ids = self.db.get_cached_serp_query(query_hash)
|
||||
patent_count = len(cached_ids) if cached_ids else 0
|
||||
|
||||
# Check if analysis indicates failure
|
||||
if analysis.startswith("No patents found") or analysis.startswith(
|
||||
|
||||
Reference in New Issue
Block a user