搜索结果不一致

时间:2014-03-27 09:06:38

标签: php mysql sql elgg

我正在对Elgg数据库进行查询。以下是有关Elgg http://docs.elgg.org/wiki/Engine/DataModel

的数据库概述
            SELECT DISTINCT e. * 
                FROM elgg_entities e
                    JOIN elgg_metadata n_table ON e.guid = n_table.entity_guid
                    JOIN elgg_metastrings msn ON n_table.name_id = msn.id
                    JOIN elgg_users_entity ue ON e.guid = ue.guid
                    JOIN elgg_metadata md ON e.guid = md.entity_guid
                    JOIN elgg_metastrings msv ON n_table.value_id = msv.id
                WHERE (
                        (
                            (
                                MATCH (
                                    ue.username, ue.name
                                )
                                AGAINST (
                                     '+gastro +surgeon'
                                    IN BOOLEAN
                                    MODE
                                )
                            )
                        )
                        OR (
                            (
                                (
                                    (
                                        (
                                            (
                                                msn.string
                                                IN (
                                                 'breifdescription'
                                                )
                                            )
                                            AND (
                                            ( 1 =1 ) 
                                            AND (
                                                n_table.enabled =  'yes'
                                                )
                                            )
                                        )
                                    )
                                )
                                AND msv.string LIKE  '%gastro surgeon%'
                            )
                        )
                    )
                AND (
                        (
                            e.type =  'user'
                        )
                    )
                AND (
                        e.site_guid
                        IN ( 1 )
                    )
                AND (
                    ( 1 =1 ) 
                    AND (
                        e.enabled =  'yes'
                    )
                )
                LIMIT 0 , 30

但是这不会返回搜索结果,因为像下面这样的简单搜索查询正在运行

            SELECT * 
            FROM  `elgg_metastrings` 
            WHERE  `string` LIKE  '%gastro surgeon%'
            LIMIT 0 , 30                    

如果搜索到的字符串只有一个单词,如外科医生,医生等,同样的查询工作正常。查询在有多个单词时失败。

尝试了很多调试它。但没有成功。有人知道第一个查询失败的原因吗?

0 个答案:

没有答案