1

我正在尝试使用我从管理员创建的 sulu 和索引内容。我创建内容,填写文章字段并发布,但在索引中,文章的“正文”未编入索引。

Afaik 有 ObjectToDocumentConverter 可以将我的对象转换为文档

AppBundle\Search\Document Object
(
    [contentFields:AppBundle\Search\Document:private] => Array
        (
        )

    [created:protected] => 
    [creatorName:protected] => 
    [creatorId:protected] => 
    [changed:protected] => 
    [changerName:protected] => 
    [changerId:protected] => 
    [properties:protected] => 
    [fields:protected] => Array
        (
            [excerptTitle] => Massive\Bundle\SearchBundle\Search\Field Object
                (
                    [name:protected] => excerptTitle
                    [type:protected] => string
                    [value:protected] => 
                    [stored:protected] => 1
                    [indexed:protected] => 1
                    [aggregate:protected] => 
                )

            [excerptMore] => Massive\Bundle\SearchBundle\Search\Field Object
                (
                    [name:protected] => excerptMore
                    [type:protected] => string
                    [value:protected] => 
                    [stored:protected] => 1
                    [indexed:protected] => 1
                    [aggregate:protected] => 
                )

            [excerptDescription] => Massive\Bundle\SearchBundle\Search\Field Object
                (
                    [name:protected] => excerptDescription
                    [type:protected] => string
                    [value:protected] => 
                    [stored:protected] => 1
                    [indexed:protected] => 1
                    [aggregate:protected] => 
                )

            [excerptCategories] => Massive\Bundle\SearchBundle\Search\Field Object
                (
                    [name:protected] => excerptCategories
                    [type:protected] => array
                    [value:protected] => Array
                        (
                        )

                    [stored:protected] => 1
                    [indexed:protected] => 1
                    [aggregate:protected] => 
                )

            [excerptTags] => Massive\Bundle\SearchBundle\Search\Field Object
                (
                    [name:protected] => excerptTags
                    [type:protected] => array
                    [value:protected] => Array
                        (
                        )

                    [stored:protected] => 1
                    [indexed:protected] => 1
                    [aggregate:protected] => 
                )

            [excerptIcon] => Massive\Bundle\SearchBundle\Search\Field Object
                (
                    [name:protected] => excerptIcon
                    [type:protected] => string
                    [value:protected] => []
                    [stored:protected] => 1
                    [indexed:protected] => 1
                    [aggregate:protected] => 
                )

            [excerptImages] => Massive\Bundle\SearchBundle\Search\Field Object
                (
                    [name:protected] => excerptImages
                    [type:protected] => string
                    [value:protected] => []
                    [stored:protected] => 1
                    [indexed:protected] => 1
                    [aggregate:protected] => 
                )

            [title] => Massive\Bundle\SearchBundle\Search\Field Object
                (
                    [name:protected] => title
                    [type:protected] => string
                    [value:protected] => articulo con todos los campos
                    [stored:protected] => 1
                    [indexed:protected] => 
                    [aggregate:protected] => 1
                )

            [webspace_key] => Massive\Bundle\SearchBundle\Search\Field Object
                (
                    [name:protected] => webspace_key
                    [type:protected] => string
                    [value:protected] => example
                    [stored:protected] => 1
                    [indexed:protected] => 1
                    [aggregate:protected] => 
                )

            [state] => Massive\Bundle\SearchBundle\Search\Field Object
                (
                    [name:protected] => state
                    [type:protected] => string
                    [value:protected] => test
                    [stored:protected] => 1
                    [indexed:protected] => 1
                    [aggregate:protected] => 
                )

            [published] => Massive\Bundle\SearchBundle\Search\Field Object
                (
                    [name:protected] => published
                    [type:protected] => string
                    [value:protected] => 2018-04-04T12:52:27+00:00
                    [stored:protected] => 1
                    [indexed:protected] => 1
                    [aggregate:protected] => 
                )

            [authored] => Massive\Bundle\SearchBundle\Search\Field Object
                (
                    [name:protected] => authored
                    [type:protected] => string
                    [value:protected] => 2018-04-04T12:52:27+00:00
                    [stored:protected] => 1
                    [indexed:protected] => 1
                    [aggregate:protected] => 
                )

            [_structure_type] => Massive\Bundle\SearchBundle\Search\Field Object
                (
                    [name:protected] => _structure_type
                    [type:protected] => string
                    [value:protected] => default
                    [stored:protected] => 1
                    [indexed:protected] => 1
                    [aggregate:protected] => 
                )

        )

    [id:protected] => 9344d287-f400-40cb-85e6-2aeafe1d3ab6
    [class:protected] => Sulu\Bundle\ContentBundle\Document\PageDocument
    [title:protected] => articulo con todos los campos
    [description:protected] => 
    [url:protected] => /articulo
    [imageUrl:protected] => 
    [locale:protected] => en
    [index:protected] => page_example
)

标题、状态和您在其中看到的所有内容都已编入索引,但哪种方式是对该内容的“正文”进行索引的最佳方式?

接下来的问题是,无论您的字段如何被调用,是否有任何方法可以索引所有内容?

提前致谢

4

1 回答 1

2

唯一的内置方法是将标签sulu.search.field(请参阅http://docs.sulu.io/en/latest/book/templates.html#search)添加到每个属性。但您可以简单地加入此过程并添加一个“内容”字段,该字段将所有属性连接起来并为其编制索引。请参阅文档http://massivesearchbundle.readthedocs.io/en/latest/extending.html#events ( massive_search.pre_index)。

于 2018-04-05T12:03:41.580 回答