M
M
mayhem2014-03-12 17:34:52
Sphinx
mayhem, 2014-03-12 17:34:52

How to get attributes in search results when searching multiple indexes in SphinxSearch version 2.1?

There is a code:

$sphinx->query('зеленые человечки', 'idx_posts_user_1,idx_posts_user_2');

There were no search problems in SphinxSearch 2.0.2. Searching multiple indexes with the same schema gave the following result:
[attrs] => Array
        (
            [user_id] => 1
        )

    [matches] => Array
        (
            [13] => Array
                (
                    [weight] => 1
                    [attrs] => Array
                        (
                            [user_id] => 2
                        )

                )

Updated to 2.1.6 and all the attributes disappeared somewhere:
[fields] => Array
        (
            [0] => post_text
        )

    [attrs] => Array
        (
        )

    [matches] => Array
        (
            [11] => Array
                (
                    [weight] => 1
                    [attrs] => Array
                        (
                        )

                )

And if to search on one of indexes - attributes appear. The index has been completely rebuilt.
sphinx.conf config:
source posts_user_1 : base
{
    sql_query		= SELECT id, user_id, post_text FROM posts WHERE user_id = 1
    sql_attr_uint	= user_id
}

index idx_posts_user_1
{
    source                  = posts_user_1
    path                    = ./data/posts_user_1
    docinfo                 = extern
    morphology              = stem_en
    charset_type            = utf-8
}

source posts_user_2 : base
{
    sql_query		= SELECT id, user_id, post_text FROM posts WHERE user_id = 2
    sql_attr_uint	= user_id
}

index idx_posts_user_2
{
    source                  = posts_user_2
    path                    = ./data/posts_user_2
    docinfo                 = extern
    morphology              = stem_en
    charset_type            =  utf-8
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question