Skip to content

firstelementjp/fe-search-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

371 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FE Search AI

FE Search AI Banner

Version License WordPress PHP Ask DeepWiki

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

  • Comprehensive unit test suite with 105 tests covering core functionality
  • Support for multiple AI providers (OpenAI, Google, Anthropic)
  • Advanced Japanese tokenization with TinySegmenter and optional Yahoo! MA API
  • Real-time post synchronization hooks
  • Cohere reranker integration for improved search relevance
  • Extensive filter hooks for customization

πŸ“– 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

βš™οΈ 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

  1. Download the latest release ZIP from the Releases page
  2. Go to Plugins β†’ Add New β†’ Upload Plugin
  3. Select the ZIP file and upload it
  4. Activate the plugin

Manual Installation

  1. Download the latest release ZIP from the Releases page
  2. Extract the ZIP file
  3. Upload the fe-search-ai/ directory to /wp-content/plugins/
  4. 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

  1. Copy wp-tests-config.php.example to wp-tests-config.php
  2. If you use direnv, copy or create a .envrc file for fe-search-ai
  3. Set DB_HOST, DB_NAME, DB_USER, DB_PASSWORD, and MYSQL_UNIX_PORT for your Local site
  4. Approve the environment with direnv allow
  5. 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 HTML
  • fe_search_ai_system_prompt: Modify the system prompt sent to AI
  • fe_search_ai_tokenize_text: Implement custom tokenizers
  • fe_search_ai_stop_words: Add/remove stop words
  • fe_search_ai_retrieved_chunks: Modify retrieved context chunks
  • fe_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:

πŸ‘¨β€πŸ’» Authors

About

AI-powered semantic search plugin for WordPress

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors