I have two sites one is maintained by us in drupal 8 and the other is maintained by another company that does the news updates etc for our company. I'm trying to figure out the best way to get a combined search in drupal. So set up a Solr instance and setup a web crawler to crawl the other site, set up drupal 8 to use the search api and solr search. But now i'm not sure what's the best way to integrate the index created by the web crawler with drupal 8. Any ideas?
1 Answer
What you could do is use the Migrate module to migrate content from one site to the other. What you need to do is:
Build a custom source plugin for it so that it fetches its data from an external source (i.e. the other site) and map it to a content type in your Drupal install.
Then set up a cron job to run the migration periodically to update the data on your end. Make sure you set the migration to "update" since by default, migrations won't happen on already-migrated content.
Create your search however you want in your site (Views, Search API, etc.) using that content type.
In D7, this was a job for the Feeds module but they don't appear to have a D8 version yet.
-
2This may work, somewhat, but Migrate and the D8 API were not built to sync content that has been deleted for example -- so what you're describing will work for new content, or updated content on the external site ... but will not necessarily "delete" the drupal copy of content should the external item be deleted from the other site.– tenkenCommented Aug 15, 2017 at 23:04
-
I don't have any access to the other site, it's not drupal 8, it's some other CMS, hence the web crawler. Commented Aug 15, 2017 at 23:18
-
You don't want to migrate content in, Solr and Solarium can solve this. I just did it for three sites sharing one core. The practical way to do this is to create a custom search controller and leverage the Solarium client to query Solr, so you get all the Drupal items and non drupal items. Search API and Views will limit it only to what it's aware of in Drupal - I have yet to see a federated approach not done with some custom code. On the upside, it does not take a lot. Just have the other company index their content to your solr instance.– KevinCommented Aug 16, 2017 at 4:31