Adding searchable fields

Search functionality is only enabled, if the LokiAdminComponents logic is able to find searchable fields for the current provider. This depends on the provider handler used (repository, collection, array) and on the arguments passed via the XML layout.

Searchable fields in the XML layout

You can hard-code the fields (columns) that should be searched through via the block argument searchable_fields.

See the page on modifying things via the XML layout.

Searchable fields with arrays

When the provider handler array is used, the provider (the class that implements Loki\AdminComponents\Provider\ArrayProviderInterface) needs to implement a method getColumns() and this method is used to supply the searchable fields. In other words, by default, all fields are searched through.

Searchable fields with collections

When the provider handler collection is used, the provider (aka the collection class) provides access to the underlying resource model, which is returning all used columns. In other words, by default, all fields are searched through.

Searchable fields with repositories

When the provider handler repository is used, the provider unfortunately does not provide any hint on what kind of fields the returned objects will include, so what searchable fields would be available.

<block>
    <arguments>
        <argument name="provider" xsi:type="string">Magento\Catalog\Api\ProductRepositoryInterface</argument>
    </arguments>
</block>
More docs coming soon
Last modified: September 1, 2025