mrg/ke-search-similarity

Fuzzy similarity search extension for ke_search (TYPO3)

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Forks: 0

Type:typo3-cms-extension

dev-main 2025-06-02 01:23 UTC

This package is auto-updated.

Last update: 2025-06-01 23:26:21 UTC


README

Vendor: MRG
Extension key: ke_search_similarity
Description: Adds fuzzy similarity search capabilities to ke_search for TYPO3.

Demo

Features

  • Fuzzy search: Find results even with typos or similar words
  • "Did you mean..." suggestions for low-result searches
  • Multiple algorithms: Levenshtein, Jaro-Winkler, Cosine, Soundex
  • Scheduler integration: Warmup and cleanup tasks for similarity cache
  • Customizable threshold for when similarity search is triggered
  • Extensible: Easily add more similarity algorithms if needed
  • Fully configurable via TypoScript and TCA
  • Multi-language support

Installation

Composer (recommended)

composer require mrg/ke-search-similarity

Or, clone/copy the extension into your typo3conf/ext/ directory.

Activate the extension

  • Go to the TYPO3 backend
  • Open Admin Tools > Extensions
  • Activate ke_search_similarity

Usage

  1. Configure ke_search as usual.
  2. The extension automatically hooks into the ke_search result process.
  3. If a search returns few or no results, fuzzy matches will be calculated and displayed.
  4. You can adjust settings (e.g., threshold, algorithm, minScore, cache TTL) via TypoScript or in the code.

Configuration

1. TypoScript Setup

Include static template:

@import 'EXT:ke_search_similarity/Configuration/TypoScript/setup.typoscript'

No configuration is required for basic usage.
Advanced settings can be adjusted in TypoScript or by modifying the extension's PHP code:

  • Algorithm: Choose between levenshtein (default), jaro, cosine, soundex
  • Threshold: Set how many results must be missing before similarity search is triggered
  • minScore: Minimum similarity score for a result to be shown
  • combinedContentField: Which fields should be combined for similarity calculation
  • Caching: Enable/disable, TTL, batch size, max entries
  • Scheduler: Configure cache warmup/cleanup tasks

2. Scheduler Task

  1. Admin Tools > Scheduler
  2. Add new task: "Cache Warmup Task"
  3. Configure:
    • Frequency: Daily
    • Algorithm: Same as TypoScript
    • Batch size: 500 (adjust based on server resources)

3. Frontend Integration

Assets are automatically included. To customize:

# Custom CSS override
page.includeCSS.tx_kesearchsimilarity = EXT:my_theme/Resources/Public/CSS/custom-similarity.css

# Custom JS extensions
page.includeJS.tx_kesearchsimilarity = EXT:my_theme/Resources/Public/JavaScript/custom-similarity.js

Database

The extension creates a table tx_kesearchsimilarity_scores for caching similarity scores.
You can manage, warm up, and clean up this cache using the provided scheduler tasks.

Extending

You can easily add more algorithms by extending the SimilarityCalculator class and registering them in TypoScript.

Development

  • Namespace: MRG\KeSearchSimilarity
  • Main classes:
    • Service\IndexContentService
    • Service\SimilarityCalculator
    • Service\SimilarityService
    • Domain\Model\SimilarityScore
    • Domain\Repository\SimilarityScoreRepository
    • Hook\SimilaritySearchHook
    • Task\CacheWarmupTask

Scheduler

  • CacheWarmupTask: Precomputes similarity scores for all indexed words.

License

This TYPO3 extension is licensed under GPL-3.0-or-later.

Authors

Contribution

Pull requests and bug reports are welcome!
For major changes, please open an issue first to discuss what you would like to change.

Disclaimer

This extension is not affiliated with or endorsed by the maintainers of ke_search or TYPO3 GmbH.

Happy searching!