FE Search AI
AI-powered semantic search plugin for WordPress
by FirstElement K.K., Daijiro Miyazawa · github.com/firstelementjp/fe-search-ai · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/firstelementjp/fe-search-ai/archive/refs/heads/main.zip
AI-powered, conversational search for WordPress. This repository contains the plugin source code, tests, and developer resources. For end-user guides and full documentation, see the links below.
✨ Recent Highlights
- Hardened frontend chat rendering with DOMPurify sanitization and safer link handling
- Strengthened chat session IDs with cryptographic random generation
- Sanitized chat history and reduced sensitive data in logs for stronger privacy
- Retrieval trace scores for BM25, Qdrant, RRF, and Cohere ranking diagnostics
- Sync index health metrics to identify stale or incomplete keyword indexes
- Hybrid candidate limit setting for tuning rerank quality and performance
- BM25 keyword ranking for improved keyword search relevance
- GitHub Releases-based automatic updates for non-WordPress.org installations
- Support for multiple AI providers (OpenAI, Google, Anthropic)
📖 Overview
FE Search AI replaces standard WordPress search with a conversational AI chat using RAG (Retrieval-Augmented Generation). It indexes your content into vector embeddings and keyword indexes, providing accurate answers based only on your website's content.
This plugin is designed to be highly extensible and performant, running on standard MySQL databases without requiring external vector databases.
⚡ Quick Links
- User Documentation: https://firstelementjp.github.io/fe-search-ai/
- Installation Guide: https://firstelementjp.github.io/fe-search-ai/#/installation
- Configuration: https://firstelementjp.github.io/fe-search-ai/#/configuration
- Hooks Reference: https://firstelementjp.github.io/fe-search-ai/#/hooks
- Releases: https://github.com/firstelementjp/fe-search-ai/releases
- Issues: https://github.com/firstelementjp/fe-search-ai/issues
or AI-powered documentation & Q&A:
⚙️ Requirements
- WordPress 6.6 or higher
- PHP 7.4 or higher (PHP 8.0+ required for built-in Japanese tokenizer)
- MySQL 5.7 or higher
- OpenSSL extension
🚀 Installation
From WordPress Admin
- Download the latest release ZIP from the Releases page
- Go to Plugins → Add New → Upload Plugin
- Select the ZIP file and upload it
- Activate the plugin
Manual Installation
- Download the latest release ZIP from the Releases page
- Extract the ZIP file
- Upload the
fe-search-ai/directory to/wp-content/plugins/ - Activate the plugin from the WordPress admin screen
[!IMPORTANT] Use the release ZIP file for installation, not Source code (zip).
💻 Local Development
git clone https://github.com/firstelementjp/fe-search-ai.git
cd fe-search-ai
composer install
npm install
After installing dependencies, place the plugin in your local WordPress environment and activate it from the admin dashboard.
🧪 Testing
PHPUnit for FE Search AI is designed to run in a local WordPress environment.
PHPUnit setup for Local by Flywheel
- Copy
wp-tests-config.php.exampletowp-tests-config.php - If you use
direnv, copy or create a.envrcfile forfe-search-ai - Set
DB_HOST,DB_NAME,DB_USER,DB_PASSWORD, andMYSQL_UNIX_PORTfor your Local site - Approve the environment with
direnv allow - Run
composer install
Example setup command:
cp wp-tests-config.php.example wp-tests-config.php
Example environment values:
export DB_HOST=localhost
export DB_NAME=local
export DB_USER=root
export DB_PASSWORD=root
export MYSQL_UNIX_PORT="/Users/your-name/Library/Application Support/Local/run/xxxxxxx/mysql/mysqld.sock"
Verify the MySQL socket path from the Database tab in Local before running tests.
Run PHPUnit from the plugin root:
cd wp-content/plugins/fe-search-ai
Run all tests:
composer test
The equivalent direct PHPUnit command is:
./vendor/bin/phpunit
Run coverage:
composer run test-coverage
Coverage reports are generated in:
tests/coverage/
If the test database connection fails in Local, confirm that MYSQL_UNIX_PORT is loaded in the current shell:
printenv | grep MYSQL_UNIX_PORT
If .envrc was updated, reload it before running PHPUnit:
direnv allow
direnv reload
composer test
🛠️ Development Commands
# PHP/Composer
composer test # Run test suite
composer phpcs # Check coding standards
composer phpcbf # Fix coding standards automatically
# Node.js/npm
npm run build # Build/minify frontend assets
npm run lint:js # Check JavaScript coding standards
npm run lint:js:fix # Fix JavaScript coding standards
npm run dev # Development build with source maps
npm run watch:all # Watch for changes and rebuild automatically
See package.json for the complete list of available npm scripts.
📝 Developer Notes
Japanese Tokenization
The plugin includes built-in support for Japanese tokenization using TinySegmenter (lightweight, dictionary-free). For higher accuracy, you can optionally enable the Yahoo! Japanese Morphological Analysis API (MAService) by configuring an App ID in the settings.
Key Filter Hooks
fe_search_ai_chat_ui_html: Override the chat UI HTMLfe_search_ai_system_prompt: Modify the system prompt sent to AIfe_search_ai_tokenize_text: Implement custom tokenizersfe_search_ai_stop_words: Add/remove stop wordsfe_search_ai_retrieved_chunks: Modify retrieved context chunksfe_search_ai_rate_limit_settings: Adjust rate limit configuration
For detailed implementation notes, see the hooks documentation.
🤝 Contributing
Contributions are welcome.
Basic workflow:
- Fork the repository
- Create a feature branch from develop
- Make changes and run tests
- Open a Pull Request against develop
Please check existing issues before opening a new feature request or bug report.
📄 License
GPLv2+
See LICENSE for details.
Third-Party Libraries
This plugin incorporates the following third-party libraries:
- php-stemmer (MIT License)
- TinySegmenter (Modified BSD License)
- Source: https://github.com/u7aro/tinysegmenter-php
- Full license text: LICENSE-TinySegmenter.txt
- Web Services by Yahoo! JAPAN
- Pickr (MIT License)
- Author: Simon Wep
- Source: https://github.com/Simonwep/pickr