cpliakas / solr-search-engine
Provides a Solr search engine to the Search Framework library by leveraging the Solarium project.
1.0.0-alpha4
2013-02-15 19:53 UTC
Requires
- cpliakas/search-framework: dev-master
- solarium/solarium: 3.0.*
This package is auto-updated.
Last update: 2023-08-25 09:56:34 UTC
README
This library integrates the Solarium project with the Search Framework library. The following code is an example of how to index RSS feeds into Solr.
use Search\Framework\Indexer; use Search\Framework\SearchServiceEndpoint; use Search\Collection\Feed\FeedCollection; // @see https://github.com/cpliakas/feed-collection use Search\Engine\Solr\Solr; require 'vendor/autoload.php'; // Instantiate a collection that references the Drupal Planet feed. Collections // are simply connectors to and models of the source data being indexed. $drupal_planet = new FeedCollection('feed.drupal'); $drupal_planet->setFeedUrl('http://drupal.org/planet/rss.xml'); // Connect to a Solr server. $solr = new Solr(new SearchEngineEndpoint('local', 'http://localhost', '/solr', 8983)); // Instantiate an indexer, attach the collection, and index it. $indexer = new Indexer($solr); $indexer->attachCollection($drupal_planet); $indexer->createIndex(); $indexer->index();