定制 hopeter1018/doctrine-full-text-search-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hopeter1018/doctrine-full-text-search-bundle

Composer 安装命令:

composer require hopeter1018/doctrine-full-text-search-bundle

包简介

This bundle add doctrine full text search

README 文档

README

Introduction

This bundle aims to enable doctrine full text search. I understand there are better options such as elasticsearch.

Installation

Require the package

composer require hopeter1018/doctrine-full-text-search-bundle

Add to kernel

Symfony 4+ or Symfony Flex

Add /config/bundles.php

return [
  ...,
  HoPeter1018\DoctrineFullTextSearchBundle\HoPeter1018DoctrineFullTextSearchBundle::class => ['all' => true],
];

Symfony 2+

Add /app/AppKernel.php

$bundles = [
  ...,
  new HoPeter1018\DoctrineFullTextSearchBundle\HoPeter1018DoctrineFullTextSearchBundle(),
];

Add to doctrine config

doctrine:
  orm:
    entity_managers:
      mappings:
        HoPeter1018DoctrineFullTextSearchBundle: ~

Config

hopeter1018_doctrine_full_text_search:
  # No config yet

Usage

Entity

namespace App\Entity;

use HoPeter1018\DoctrineFullTextSearchBundle\Annotation as Fts;
use HoPeter1018\DoctrineFullTextSearchBundle\Formatter\DateTimeFormatter;

/**
 * @Fts\Entity(
 *     columns={
 *         "__property_name_1__": @Fts\Column,
 *         "__property_name_2__": @Fts\Column(formatter=DateTimeFormatter::class),
 *     },
 *     columnGroups={
 *         "__group_name_1__": @Fts\ColumnGroup(columns={
 *             "__property_name_1__": @Fts\Column,
 *             "__property_name_2__": @Fts\Column,
 *         })
 *     }
 * )
 */
class TheEntity
{
    /**
     * @Fts\Column
     * @ORM\Column(type="string", length=255)
     */
    private $propertyName1;

    /**
     * @Fts\Column
     */
    public function methodName1()
    {
        return 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
    }
}

Use thru Repository

use HoPeter1018\DoctrineFullTextSearchBundle\Entity\FullTextSearchIndex;

$fullTextSearchIndexRepo = $em->getRepository(FullTextSearchIndex::class);

$ids = $fullTextSearchIndexRepo->search('~~ The search keywords ~~', TheEntity::class, ['__name-property/group/method__']);

$repo = $em->getRepository(TheEntity::class);
$list = $repo->findBy(['id' => $ids]);

TODO

  • Add mode to have FTS index per table
  • Entity
    • Trait for PERENTITY mode
  • Repository
    • Trait for search
  • Enhance Annotation
    • Add more property
  • Add Command to
    • ReIndex
    • Search
  • Add helpers to
    • SonataAdmin
    • ApiPlatform
  • Check against different id type

统计信息

  • 总下载量: 110
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-07-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固