Download the PHP package onedrop/solr-extbase without Composer
On this page you can find all versions of the php package onedrop/solr-extbase. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package solr-extbase
Extbase integration into Apache Solr for TYPO3 CMS
This integration gives you the easy possibility to use your extbase entities during solr indexation. Very often you want to access related records and don't want to clone your business logic into TypoScript to select related records.
What does it do?
- Hooks into extbase repositories added/modified/deleted methods to update the record in solr`s indexQueue
- Provides a way to switch the language when loading extbase records (needed for correct indexation)
- Provides an interface that must be inherited by extbase models to be indexable
Usage
Assumption: You already have an indexQueue configured in solr as usual and mapped fields from TCA to the solr document.
Add IndexableEntity
interface to the desired entity model
The method addEntityFieldsToDocument
is processed after the document has been generated by the usual
solr indexer using the TypoScript configuration. Therefore you can add new fields or overwrite fields using the setField
method.
As you might have some constraints in your business logic that makes the models visible for search, you can modify the
method isIndexable
to match your custom constraints. If the method evaluates to false
the model will not be indexed
(not even the basic fields configured in TypoScript).
Modify solr configuration to use the extbase indexer
plugin.tx_solr.index.queue {
myIndexQueue = 1
myIndexQueue {
table = tx_news_domain_model_news
indexer = Onedrop\SolrExtbase\IndexQueue\EntityIndexer
repository = Vendor\Extension\Domain\Repository\FoobarRepository
fields {
title = title
# ... more fields
}
}
}
You must set the indexer of the indexQueue and the repository that will be used to load the model using findByUid
.
Documentation and Support
-
Slack Channel:
https://typo3.slack.com/messages/ext-solr/
(request your invite for Slack here: https://forger.typo3.org/slack)
Contributions
Feel free to give us a pull request.