versh23/manticore-bundle

Manticore PHP 集成,用于您的 Symfony 项目,使用 Manticore 和 Doctrine ORM

安装: 35

依赖: 0

建议者: 0

安全: 0

星标: 2

关注者: 3

分支: 2

开放问题: 0

类型:symfony-bundle

v0.0.3 2020-03-23 09:21 UTC

This package is auto-updated.

Last update: 2024-09-05 23:20:10 UTC


README

Build Status

安装

此扩展包应使用 Composer 安装,具体过程取决于您的应用程序是否使用 Symfony Flex。

以下说明假设您已经全局安装了 Composer,如 Composer 文档中的 安装章节 所述。

使用 Symfony Flex 的应用程序

打开命令行,进入项目目录并执行

composer require versh23/manticore-bundle

不使用 Symfony Flex 的应用程序

步骤 1:下载扩展包

打开命令行,进入项目目录并执行以下命令以下载此扩展包的最新稳定版本

composer require versh23/manticore-bundle

步骤 2:启用扩展包

然后,通过将其添加到项目 app/AppKernel.php 文件中注册的扩展包列表中来启用扩展包

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Versh23\ManticoreBundle\Versh23ManticoreBundle(),
        );

        // ...
    }

    // ...
}

配置

创建配置文件 config/packages/manticore.yaml

示例

versh23_manticore:
    host: 'manticore'
    port: 9306
    indexes:
        my_entity:
            class: App\Entity\MyEntity
            fields:
                description: ~ #short syntax
                name:          #full syntax
                    property: name

            attributes:
                free: bool #short syntax
                status:    #full syntax
                    property: status
                    type: string

在此示例中,将创建一个 manticore.index_manager.article 服务,允许操作索引 manticore.index.article

  • 截断索引 (truncateIndex())
  • 刷新索引 (flushIndex())
  • 替换/插入/删除操作 (replace()insert()delete()bulkReplace()bulkInsert() )
  • 创建一个 Pagerfanta 对象 (findPaginated()) https://github.com/whiteoctober/Pagerfanta
  • 简单查找对象 (find())
  • 通过 SphinxQL 语法创建自定义查询 (createQuery)

对于 App\Entity\MyEntity,将创建事件监听器 manticore.listener.article,允许更新您的 RT 索引 my_entity

有两个有用的命令

  • manticore:index:config - 渲染配置示例
  • manticore:index:populate - 填充 RT 索引