Download the PHP package nramos/search-indexer without Composer

On this page you can find all versions of the php package nramos/search-indexer. 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 search-indexer

codecov 🌍 Documentation

This documentation is available in:

🇬🇧 English

🇫🇷 Français

🇫🇷 Français

Le package nramos/search-indexer permet d'indexer des entités Doctrine sur différents systèmes d'indexation via des annotations. Actuellement, un adaptateur pour Meilisearch est disponible, mais la structure permet d'ajouter d'autres systèmes d'indexation à l'avenir.

Installation

Installez le package via Composer :

Configuration

Déclarer le service dans services.yaml:

Exemple pour Meilisearch:

Déclarer l'index sur une entité

Utilisez l'annotation #[SearchIndex] sur une classe pour définir un index. Par exemple :

Il faut obligatoirement ajouter une clé primaire à l'indexer :

Configurer les propriétés à indexer

Gérer les relations

Lorsque vous avez des relations comme ManyToMany, vous pouvez spécifier des relationProperties pour indexer des valeurs provenant de la relation. Par exemple :

Dans cet exemple, la propriété name des entités liées à Heating sera indexée sous le nom heatings.

Désactiver l'auto-indexation

Si vous ne souhaitez pas utiliser l'indexation automatique fournie par le package, vous pouvez désactiver l'auto-indexation en définissant autoIndex: false dans l'annotation #[SearchIndex] et en créant un subscriber personnalisé pour gérer l'indexation.

Utilisation des filtres de recherche

Le package propose une interface SearchFilterInterface pour faciliter la création de requêtes complexes. Un adaptateur pour Meilisearch est disponible par défaut. Voici un exemple d'utilisation avec Meilisearch :

Exécution de la recherche

Pour exécuter la recherche, vous devez implémenter l'interface SearchClientInterface. Un client Meilisearch est fourni par le package sous la classe MeilisearchClient. Voici un exemple :

Exemple d'entité

Voici un exemple d'entité avec les annotations pour l'indexation :

Aller plus loin

Créer un subscriber personnalisé

Pour gérer l'indexation manuellement, vous pouvez créer un subscriber personnalisé pour écouter les événements Doctrine et appeler l'indexation manuellement. Voici un exemple implémenté globalement :

Effectuer une multi recherche

Pour effectuer une recherche multi-index, vous pouvez utiliser la méthode searchMulti du client. Voici un exemple :

Créer un adaptateur pour un autre système d'indexation

Vous pouvez vous baser sur la class MeilisearchClient. Veillez à bien changer le services dans votre fichier services.yaml:

Conclusion

Le package nramos/search-indexer vous permet d'indexer vos entités de manière flexible et automatique via des annotations. Il supporte actuellement Meilisearch, mais peut être étendu pour d'autres systèmes d'indexation.

🇬🇧 English

The nramos/search-indexer package allows indexing Doctrine entities on different indexing systems via annotations. Currently, an adapter for Meilisearch is available, but the structure allows adding other indexing systems in the future.

Installation

Install the package via Composer:

Configuration

Declare the service in services.yaml:

Example for Meilisearch:

Declare the index on an entity

Use the #[SearchIndex] annotation on a class to define an index. For example:

Configure the properties to index

Use the #[SearchProperty] annotation on entity properties to define how they will be indexed:

You must add a primary key to the index:

Configure indexed properties

Handling relations

For relations like ManyToMany, you can specify relationProperties to index values from the related entity. Example:

In this example, the name property of related Heating entities will be indexed under heatings.

Disable auto-indexing

If you don't want to use the package's automatic indexing, you can disable it by setting autoIndex: false in the #[SearchIndex] annotation and creating a custom subscriber to handle indexing manually.

Using search filters

The package provides a SearchFilterInterface to simplify creating complex queries. A Meilisearch adapter is available by default. Here is an example usage with Meilisearch:

Executing a search

To execute a search, you need to implement the SearchClientInterface. A Meilisearch client is provided in the package under MeilisearchClient. Example:

Example entity

Here is an example entity with indexing annotations:

Going further

Create a custom subscriber

To manually manage indexing, create a custom subscriber to listen to Doctrine events and trigger indexing manually. Example:

Perform multi-index search

Use the searchMulti method to search across multiple indexes:

Create an adapter for another indexing system

Use the MeilisearchClient class as a reference and update services.yaml:

Conclusion

The nramos/search-indexer package allows flexible and automatic entity indexing via annotations. It currently supports Meilisearch but can be extended to other indexing systems.


All versions of search-indexer with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
symfony/dependency-injection Version ^6.2|^7.1
symfony/config Version ^6.2|^7.1
doctrine/orm Version ^3.2
doctrine/doctrine-bundle Version ^2.0
symfony/http-client Version ^6.2|^7.1
symfony/http-kernel Version ^6.2|^7.1
symfony/framework-bundle Version ^6.2|^7.1
symfony/dotenv Version ^6.2|^7.1
symfony/monolog-bundle Version ^3.10
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 nramos/search-indexer contains the following files

Loading the files please wait ....