我正在尝试使用我从管理员创建的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
)
标题,状态以及您在其中看到的所有内容都已编入索引,但这是索引该内容“正文”的最佳方式?
以下问题将是,有什么方法可以索引所有内容,无论你的字段如何被调用?
提前致谢
答案 0 :(得分: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
)。