Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Bambi Postgres Text Search Bundle Laravel Package

bambi/bambi-postgres-text-search-bundle

View on GitHub
Deep Wiki
Context7

BambiPostgresTextSearchBundle

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

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui