• Resolved braino

    (@braino)


    Hello, i was wondering if you have post type overlapping omnisearch on your roadmap. Currently my users can click on the different custom post types to search from within but i would love to see a feature that users can type and the system searches for everything

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter braino

    (@braino)

    hi there, following up on my question, did you find time to check out the question? best regards!

    Plugin Contributor digamberpradhan

    (@digamberpradhan)

    Hi @braino ,

    Technically it’s possible to have an omni search with the current setup.
    How:
    This assumes everything is a custom post type or default post type.
    That way the Post ID for all posts would be unique. So updating and deleting resources across different post types would be possible.
    You can there for name all the post types as the same collection name.

    //only necessary if the default post schema is not necessary
    function cm_typesense_add_book_schema( $schema, $name ) {
        if ( $name == 'book' ) {
            $schema = [
                'name'                  => 'book',
                'fields'                => [
                    [ 'name' => 'post_content', 'type' => 'string' ],
                    [ 'name' => 'post_title', 'type' => 'string' ],
                    [ 'name' => 'post_type', 'type' => 'string' ],
                    [ 'name' => 'post_author', 'type' => 'string' ],
                    [ 'name' => 'comment_count', 'type' => 'int64' ],
                    [ 'name' => 'is_sticky', 'type' => 'int32' ],
                    [ 'name' => 'post_excerpt', 'type' => 'string' ],
                    [ 'name' => 'post_date', 'type' => 'string' ],
                    [ 'name' => 'post_id', 'type' => 'string' ],
                    [ 'name' => 'post_modified', 'type' => 'string' ],
                    [ 'name' => 'id', 'type' => 'string' ],
                    [ 'name' => 'permalink', 'type' => 'string' ],
                    [ 'name' => 'post_thumbnail', 'type' => 'string' ],
                    [ 'name' => 'genre', 'type' => 'string[]', 'facet' => true ]
                ],
                'default_sorting_field' => 'comment_count'
            ];
        }
    
    
        return $schema;
    }
    
    add_filter( 'cm_typesense_schema', 'cm_typesense_add_book_schema', 10, 2 );

    https://codemanas.github.io/cm-typesense-docs/advanced-custom-post-types/#adding-schema

    Some things to remember is to have the same/shared schema for your post types. So that the final result (frontend) looks like how you would like it to.

    Currently the plugin in UI/UX is not intuitive enough to allow omnisearch.
    We’re working on this – but it’s not the top priority on the development cycle.

    Thread Starter braino

    (@braino)

    checking in! are you considering to offer this in the core plugin soon since some time has passed?

    • This reply was modified 1 year, 2 months ago by braino.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘post type overlapping omnisearch: Roadmap?’ is closed to new replies.