定制 bambi/bambi-postgres-text-search-bundle 二次开发

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

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

bambi/bambi-postgres-text-search-bundle

Composer 安装命令:

composer require bambi/bambi-postgres-text-search-bundle

包简介

Symfony bundle that integrates PostgreSQL text search features.

README 文档

README

Symfony bundle that integrates PostgreSQL full-text search functionality in Api-Platform.

This bundle has been developed for and tested with PostgreSQL 12.

Work in Progress!

This bundle is still in a very early stage of development.

Installation

composer require bambi/bambi-postgres-text-search-bundle

Basic Usage

namespace App\Entity;

class Author
{
    private string $name;
    
    ...
}

class Book
{
    private string $name;
    private string $isbn;
    private Author $author;
    
    ...
}
<services>
    <service id="app.book.text_search_match_filter"
             parent="bambi_postgres_text_search.filter.text_search_match_filter">
        
        <!-- Properties that should be searched -->
        <argument type="collection">
            <argument>name</argument>
            <argument>isbn</argument>
            <!-- You can also search fields of associated entities -->
            <argument>author.name</argument>
        </argument>
        
        <!-- Optionally you can configure the parameter name (default="ts_query") for the for the API,
         the config string (default="'english'") used by Postgres for text search and if the column you
         are searching is already vectorized (default=false). -->
        <argument key="$textSearchParameterName" type="string">postgres_text_search</argument>
        <argument key="$postgresTsConfigString" type="string">'german'</argument>
        <argument key="$preVectorized">true</argument>

        <tag name="api_platform.filter" />
    </service>
</services>

Bear in mind that the value for postgresTsConfigString is directly passed on to your Postgres Database. Don't forget Quotes if you want to pass a literal value ('german' instead of german)

<resource class="App\Entity\Book">
    <collectionOperations>
        <collectionOperation name="get">
            <attribute name="method">GET</attribute>
            ...
            <attribute name="filters">
                <attribute>app.book.text_search_match_filter</attribute>
            </attribute>
        </collectionOperation>
    </collectionOperations>
</resource>

You can access this filter via: GET /api/books?postgres_text_search=QUERY_STRING

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-04-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固