You are browsing the documentation for version 4.2 of OroCommerce, OroCRM and OroPlatform, which is no longer maintained. Security Support ends in January 2024. Read version 5.0 (the latest LTS version) of the Oro documentation to get the updated information.
See our Release Process documentation for more information on the currently supported and upcoming releases.
search.yml file is used to configure how your entities are indexed to make them usable by
the internal search engine of OroPlatform. A fully working example can look like this:
search: Acme\DemoBundle\Entity\Product: alias: demo_product search_template: AcmeDemoBundle:result.html.twig label: Demo products route: name: acme_demo_search_product parameters: id: id mode: normal title_fields: [name] # deprecated since 2.0 fields: - name: name target_type: text - name: description target_type: text target_fields: [description, another_index_name] parameter. - name: manufacturer relation_type: many-to-one relation_fields: - name: name target_type: text target_fields: [manufacturer, all_data] - name: id target_type: integer target_fields: [manufacturer] - name: categories relation_type: many-to-many relation_fields: - name: name target_type: text target_fields: [all_data]
An alias used in the
from keyword in advanced search.
The list of fields that will be added to the search index. Each entry must be a map that can use the following keys to configure how the property value will be indexed:
The name of the entity property. This option is required.
When the field represents an association (i.e. a value is configured for relation_type), this is a list of fields from the target entity to index. For each entry all the options of the parent fields option apply.
When the property denotes an association with another entity, the type of association (one of
many-to-one) must be configured with this
target_fields option list the named indexes to which the property value will be added.
For example, a contact may have the properties
all three properties should be searched when the user is loooking for a value in the virtual
name field (when using the advanced search API). In this case, all three properties will list
name field in
search: Acme\ContactBunde\Entity\Contact: fields: - name: firstName target_type: text target_fields: [name] - name: lastName target_type: text target_fields: [name] - name: namePrefix target_type: text target_fields: [name]
text, the data will also be stored in the
target_fields option is not given, the data is added to a virtual field whose name is
the name as the field’s name (i.e. what is specified under the
The type of the virtual search field (possible values are
text). This option is required.
A human readable label to identify the entity in the search results. The configured string will be passed to the translator.
string default: normal
The entity behavior for inheritance. For possible values and what they mean, have a look at the constants of the Mode class.
The route for which a URL is generated when linking from the search result to a concrete entity. The available options are:
The name of the route.
The routing parameters, each key is the name of the routing parameter and the value is the name of one of the configured fields.
Note: Usage of this field is deprecated starting from 2.0. Register an EntityNameProvider instead. The list of fields to build the title for the result set. The value used here denote to the configured fields.