Skip to content

Conversation

@jjroelofs
Copy link
Contributor

Summary

  • Adds SearchQueryCollector service to collect and expose search query intelligence
  • Creates database table content_intel_search_log for logging queries
  • New Drush commands: ci:searches and ci:search-status
  • Identifies content gaps (high-frequency queries with zero/low results)

Features

Data Collection:

  • Logs search keywords, result counts, and timestamps
  • Supports multiple data sources (custom table, Search API log)

Drush Commands:

drush ci:searches              # List top search queries
drush ci:searches --gaps       # Show content gaps (zero-result searches)
drush ci:search-status         # Check logging status

Output Example:

- query: "pricing plans"
  count: 145
  results_count: 0
  last_searched: "2024-01-15T10:30:00Z"

Use Case

Enables AI content strategy tools to identify what users search for but don't find — revealing content gaps and priority topics.

Test plan

  • Run drush updb to create the logging table
  • Verify drush ci:search-status shows "content_intel" source
  • Verify drush ci:searches returns empty table (no data yet)
  • Add test data and verify queries display correctly

Closes #10

Jurriaan Roelofs added 6 commits January 28, 2026 10:49
Fix #2: Add ContentIntelCollectorInterface
- Create interface defining the service contract
- Update ContentIntelCollector to implement the interface
- Add loadEntities() method for bulk entity loading

Fix #3: Add logging for silent exception in ContentTranslationPlugin
- Inject logger service
- Log warnings when translation metadata fetch fails
- Add metadata_error field to output for debugging

Fix #4: Optimize batch command with loadMultiple()
- Use loadEntities() for bulk loading instead of individual loads
- Reduces N+1 queries to single loadMultiple() call
- Improves performance for large batch operations
- Install statistics contrib module in drupal-check script
- Add PHPStan config to ignore optional statistics module errors
- Fix type safety: add ContentEntityInterface check in listEntities()
- Fix DI: inject date.formatter service in StatisticsPlugin
- Preserve input order in loadEntities() method
- Document getPlugins() return structure in interface PHPDoc
Add SearchQueryCollector service to collect and expose search query
intelligence for content strategy analysis.

Features:
- New database table content_intel_search_log for query logging
- SearchQueryCollector service with support for multiple data sources
- Drush commands: ci:searches and ci:search-status
- Content gap detection (queries with zero/low results)

Closes #10
@jjroelofs
Copy link
Contributor Author

Closing - approach doesn't align with content_intel's entity-centric architecture. Will reconsider with proper entity-level search performance tracking (impressions/clicks per content item) instead of query-level logging.

@jjroelofs jjroelofs closed this Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Search Query Log Plugin

2 participants