0

I am using Symfony NelmioSolariumBundle and need to make Solr full data import, has a Solarium such type of command?

If no, how to execute custom request for data import through Solarium API:

/core/dataimport?command=full-import
Sam Ivichuk
  • 999
  • 1
  • 10
  • 22

2 Answers2

4

Found the way to do it:

use Solarium\Core\Client\ClientInterface,
    Solarium\Core\Client\Request;

class IndexService
{
    /** @var ClientInterface */
    private $client;

    /**
     * @param ClientInterface $client
     */
    public function __construct(ClientInterface $client)
    {
        $this->client = $client;
    }

    public function triggerFullDataImport()
    {
        $request = new Request();
        $request->setHandler('dataimport');
        $request->addParam('command', 'full-import');

        $this->client->executeRequest($request);
    }
}
Sam Ivichuk
  • 999
  • 1
  • 10
  • 22
0

You don't need any magic to do that, just call the URL with file_get_contents("http://...."). If fopen wrappers are disabled (they usually aren't), you can use the cURL module if its installed to do the same.

MatsLindh
  • 49,529
  • 4
  • 53
  • 84
  • It seems like I asked a question in a very wrong way. I am using Symfony NelmioSolariumBundle and wanted to know how to do this throught API that this bundle provide – Sam Ivichuk Jun 22 '16 at 13:06