meetmage / module-semantic-search
Free AI semantic search for Magento 2: hybrid keyword + vector search on your own OpenSearch, with OpenAI, Google Gemini or a local Ollama model. Shoppers find products by meaning, not only exact words.
Package info
github.com/meetmage-extensions/magento2-module-semantic-search
Type:magento2-module
pkg:composer/meetmage/module-semantic-search
Requires
- php: ~8.1.0||~8.2.0||~8.3.0||~8.4.0||~8.5.0
- magento/framework: ^103.0
- magento/module-advanced-search: *
- magento/module-backend: *
- magento/module-catalog: *
- magento/module-catalog-search: *
- magento/module-config: *
- magento/module-elasticsearch: *
- magento/module-open-search: *
- magento/module-search: *
- magento/module-store: *
Requires (Dev)
- bitexpert/phpstan-magento: ^0.32
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^1.12
- phpunit/phpunit: ^10.5
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Free AI search for Magento 2 and Adobe Commerce. Shoppers find products by meaning, not only by the exact words in the product name: "rain coat" finds a waterproof shell, "shoes for mountains" finds hiking boots, "something to keep coffee hot" finds an insulated flask.
It runs on the OpenSearch your store already uses, with hybrid search: Magento's keyword search keeps working as before, and meaning-based matches are added and re-ranked on top. No monthly search service, no separate vector database.
Tested on Magento Open Source 2.4.9 with OpenSearch 2.19 and a Hyvä Theme storefront.
What it does
| Search | Keyword search finds | With AI Semantic Search |
|---|---|---|
| rain coat | a tent (its description mentions rain) | Drizzle Packable Shell, Stormguard Insulated Parka, Summit Down Jacket |
| shoes for mountains | Road Runners, a sleeping bag, Hiking Boots (3rd) | Trailblazer Hiking Boots first |
| warm jacket for rain | Down Jacket; the waterproof parka is 5th | Down Jacket, Stormguard Insulated Parka, Drizzle Packable Shell |
| boots, Trail Backpack | exact match first | unchanged: exact matches stay first |
| xyzzy, pizza (nothing relevant) | no results | no results (AI is skipped when nothing is similar enough) |
Results from the 26-product test catalog with the free nomic-embed-text model on Ollama.
How it works
- Product vectors. Each product's name, short and full description, categories and the attributes you choose are turned into a vector (an "embedding") by the AI provider. Vectors are stored in Magento and added to the OpenSearch product index. A product is only sent to the provider again when its text changes.
- Search. On the storefront quick search, the search term is turned into a vector too (cached for 30 days), and a k-NN (nearest neighbour) clause is added next to Magento's keyword clauses. Filters, layered navigation, sorting and visibility work exactly as before.
- Ranking. Raw vector scores sit in a narrow band, while keyword scores go from 0 to 60+. So the meaning-based score is rescaled per search: the closest match gets the full Semantic Weight, products within the Relevance Window below it get less, and everything else gets nothing. When even the closest match is below Minimum Similarity, the search runs on keywords only.
- Safe by default. If the provider is slow or down, the search runs on keywords only (search-time calls time out after 3 seconds, and AI is paused for a minute after a failure). Nothing changes until the index has the vector field, so enabling the module can't break search before the reindex.
Embedding providers
| Provider | Cost | Privacy | Default model |
|---|---|---|---|
| Ollama | Free (runs on your server) | No text leaves your infrastructure | nomic-embed-text (768) |
| OpenAI | A few cents per thousand products | Product text and search terms go to OpenAI | text-embedding-3-small (768) |
| Google Gemini | A few cents per thousand products | Product text and search terms go to Google | gemini-embedding-001 (768) |
Only product text and search terms are sent: never customer data. The default Minimum Similarity (0.80) is
calibrated for nomic-embed-text; for OpenAI and Gemini it's off until you set it. Use the comparison page to see
the best-match score of a few relevant and a few unrelated searches, and set it between the two.
Requirements
- Magento Open Source or Adobe Commerce 2.4.6 – 2.4.9 with OpenSearch as the search engine
- The OpenSearch k-NN plugin, which is included in the standard OpenSearch download and Docker images
(check with
curl localhost:9200/_cat/plugins). Some managed services name it differently or need it enabled. - An embedding provider: Ollama (e.g.
ollama pull nomic-embed-text), an OpenAI key or a Gemini key
Elasticsearch is not supported: the module does nothing when the engine is not OpenSearch.
Installation
composer require meetmage/module-semantic-search bin/magento module:enable MeetMage_SemanticSearch bin/magento setup:upgrade
Then:
- Stores → Configuration → MeetMage → AI Semantic Search: choose the provider, add the API key or Ollama URL, and set Enable to Yes.
- Create the vectors and rebuild the search index:
bin/magento meetmage:semantic:embed --all bin/magento indexer:reindex catalogsearch_fulltext
- Open Marketing → SEO & Search → AI Semantic Search to check coverage and compare results.
New and changed products are embedded by cron every 15 minutes.
Admin page
Marketing → SEO & Search → AI Semantic Search
- Setup: provider and model, OpenSearch version, k-NN plugin status
- Coverage: per store view, whether the index has the vector field and how many products have a vector
- Compare search results: any search term, keyword-only next to with-AI, with scores and the best-match score
- Embed Changed Products Now button
Command line
bin/magento meetmage:semantic:embed # new and changed products only bin/magento meetmage:semantic:embed --all # check every product (unchanged ones cost nothing) bin/magento meetmage:semantic:compare "rain coat" --store=1
Configuration
| Setting | Default | Description |
|---|---|---|
| Enable | No | Turn semantic search on |
| Provider | Ollama | Ollama, OpenAI or Google Gemini |
| API Key / Ollama URL | – | Stored encrypted |
| Model | provider default | Any embedding model of the provider |
| Vector Dimensions | 768 | Must match the model (Ollama models have a fixed size) |
| Extra Attributes | manufacturer, color, material | Attribute codes added to the product text |
| Semantic Weight | 40 | Points the closest match by meaning adds (keyword matches score about 20–60) |
| Relevance Window | 0.06 | How far below the closest match products still get points |
| Semantic Matches per Search | 50 | Nearest products considered per search |
| Minimum Similarity | auto | Below this best-match score, search runs on keywords only |
After changing the provider, model or dimensions, run meetmage:semantic:embed --all and a full
catalogsearch_fulltext reindex. The admin page warns you when vectors are from an older setting.
Limits
- Storefront quick search (the search box and results page). Category pages and GraphQL search are unchanged.
- One vector per product per store view: multi-language stores embed each translation.
- Very large catalogs (100,000+ products) should start with
--limitand let cron catch up.
Support
Free and open source (MIT). Bugs and ideas: GitHub issues. Need help tuning search for your catalog? Meet Shekhat, freelance Magento developer.
