Download the PHP package yu-dev/module-ai-search-engine without Composer

On this page you can find all versions of the php package yu-dev/module-ai-search-engine. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package module-ai-search-engine

Magento 2 Search Engine - Keyword & Semantic (Vector) Product Search

Live demo

🔗 Demo: shop.yu.net.ua

An infrastructure module: structured product search that talks directly to the store's search engine (Elasticsearch or OpenSearch - whichever is configured in Magento), bypassing Magento's standard search-query-building layer, with optional semantic (meaning-based) matching blended in. It doesn't show anything on the storefront by itself and needs no admin configuration for keyword search - Yu_AiChat (product search inside the chat assistant) and Yu_AiCatalogSearch (AI-powered catalog search) are built on top of it.

Why it exists

Magento's own search layer (SearchInterface) behaves unreliably in some scenarios - when called from a context other than the search results page (for example, from an AI assistant's tool) - and doesn't always honor every filter (in particular, price range). Yu_AiSearchEngine works around this limitation by talking to the search index directly, while still reading its connection settings (engine address, index name) from Magento's standard configuration - so switching the search engine in the admin panel doesn't require reconfiguring this module separately.

Another reason search goes through a dedicated module instead of being assembled on the fly wherever it's needed: security. The call only accepts plain data (a query string, attribute-value pairs), never a ready-made search query as a whole. This rules out injecting arbitrary code into the search engine, even when the search parameters come from AI-generated text.

Features

Semantic (Vector) Search

Vectors come from Yu_AiLlm's OpenAI embeddings provider (see that module's README) and live in a separate, per-store Elasticsearch index this module owns and keeps in sync via a native Magento indexer, AI Search Vector - visible in Index Management, supporting both "Update on Save" and "Update by Schedule" like any other Magento indexer.

In "Update on Save" mode, a product's vector is refreshed right after the product is saved or deleted in the admin panel, and after the mass "Update Attributes" / "Update Websites" actions. Computing a vector means a call to the embedding API, so a product save takes roughly a second longer; on large catalogs or frequent bulk edits "Update by Schedule" (done in the background by cron) is the better choice. Two safety rules apply to "Update on Save":

How the two result lists are combined: keyword search finds the products that literally match the query and every attribute requirement (e.g. "color: green"); vector search finds the products closest in meaning. Vector matches are held to the same requirements - a product that is semantically close but has a different color is dropped, not blended in. A product that doesn't have the attribute at all is not treated as contradicting it, exactly as on the keyword side.

Turning it on:

  1. Configure and enable an embedding-capable LLM provider under Stores → Configuration → AI → LLM AI (currently OpenAI).
  2. Run a full reindex of AI Search Vector (bin/magento indexer:reindex yu_vector_search, or via Index Management in the admin panel).
  3. Enable semantic search under Stores → Configuration → AI → Search Engine AI → Semantic Search (see Configuration below).

Until step 2 has completed at least once, the vector index doesn't exist and every hybrid search request quietly falls back to keyword only - turning on Semantic Search before reindexing doesn't break anything, it just doesn't do anything yet either.

What a product's vector is built from

A vector (an "embedding") is a list of numbers an AI model computes from a piece of text; two texts that mean similar things get similar numbers, which is what lets "jacket for rainy weather" find a product whose description never says "rainy". So the vector can only know what's in the text it was computed from. For each product, that text is assembled from, in this order:

  1. Name
  2. Category paths - the product's categories as breadcrumbs ("Parent > Child"), in the store view's language. Inactive categories are left out, and a parent category isn't repeated on its own when a deeper path already contains it.
  3. Attribute values - one "Label: value, value" line per attribute, using the store view's labels (the raw option IDs stored in the database mean nothing to an AI model).
  4. Short description and description - with HTML tags removed, so markup from the WYSIWYG editor or Page Builder doesn't pollute the vector.

The order matters: the embedding model accepts a limited amount of text, so a very long product text is cut from the end - the description loses its last paragraphs, while the name, categories and attributes always make it in.

Which attributes are included is configurable (see Configuration). The default, Automatic, takes the attributes you've marked Use in Search or Use in Layered Navigation that have dropdown, multiple-select or short text values. Yes/No attributes are left out by default - a line like "Label: No" carries little meaning - but you can pick them explicitly, in which case the product gets just the label, and only when the value is Yes. Text values made only of digits or codes are skipped, since they add noise rather than meaning.

A vector is a soft signal, not a filter: including a color attribute makes "red dress" lean towards red products, but it doesn't guarantee them. Exact requirements are enforced by the keyword side of the search and its filters, exactly as without semantic search.

Changing these settings, or renaming categories, only affects vectors after the next full reindex of AI Search Vector.

Requirements

Installation

Keyword search needs no admin configuration and works immediately. The module doesn't do anything on the storefront by itself - it's used by other modules (Yu_AiChat, Yu_AiCatalogSearch), which are installed separately. Semantic search is opt-in - see the Semantic (Vector) Search section above.

Configuration

Stores → Configuration → AI → Search Engine AI → Semantic Search

Stores → Configuration → AI → Search Engine AI → Vector Index Content

See "What a product's vector is built from" above.

Author

Yuriy Akishin:

License

MIT


All versions of module-ai-search-engine with dependencies

PHP Build Version
Package Version
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package yu-dev/module-ai-search-engine contains the following files

Loading the files please wait ...