2017 © Pedro Peláez
 

library solr-client

Apache SOLR client for ZF2

image

bostjanob/solr-client

Apache SOLR client for ZF2

  • Tuesday, January 24, 2017
  • by BostjanOb
  • Repository
  • 3 Watchers
  • 11 Stars
  • 503 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 0 Open issues
  • 1 Versions
  • 1 % Grown

The README.md

THIS PROJECT IS DEPRECATED. Take a look at [solarium project] (http://www.solarium-project.org)

Apache Solr Client for Zend Framework 2

Features :, (*1)

  • Adding, updating and deleting documents
  • Query builder
  • Facets
  • Spellcheck
  • Zend Developer Toolbar plugin

Requirements

  1. Zend Framework 2
  2. [Apache Solr] (http://lucene.apache.org/solr/)
  3. CURL module enabled in php

In your solrconfig.xml you must have php serialized query response writer enabled: <queryResponseWriter name="phps" class="solr.PHPSerializedResponseWriter"/>, (*2)

Installation

  1. Add "bostjanob/solr-client": "dev-master" to your composer.json
  2. Run php composer.phar install
  3. Enable the module in your config/application.config.php by adding SolrClient to modules

Setting up your connection

Setup your connection by adding the module configuration to any valid ZF2 config file. This can be any file in autoload/ or a module configuration (such as the Application/config/module.config.php file)., (*3)

<?php
return array(
    'solr' => array(
        'connection' => array(
            'solr_default' => array(
                'host' => 'HOSTNAME',
                'port' => 'PORT',
                // for basic auth
                'user' => 'USERNAME', 
                'password' => 'PASSWORD',

                // web path where solr is installed
                'path' => '/', 

                // scheme: http or https
                'scheme' => 'http'
            ),
        ),
    ),
);

Getting SolrClient

Access the solrClient using the following alias:, (*4)

$client = $this->getServiceLocator()->get('solr.solr_default');

Inserting or updating documents

Coming soon..., (*5)

Deleting documents

Deleting documents by ID, (*6)

$solrClient->deleteById(1);
$solrClient->commit();

// more documents at once, and commit
$solrClient->deleteById(array(1,2,3,4), true);

//or all data
$solrClient->deleteByQuery("*:*");
$solrClient->commit();

Commit, optimize

More info about "commit" and "optimize", (*7)

Commit

public function commit($optimize = false, $waitFlush = true, $waitSearcher = true)

Optimize

    public function optimize($waitFlush = true, $waitSearcher = true, $maxSegments = 1)

Query builder

Coming soon..., (*8)

The Versions

24/01 2017

dev-master

9999999-dev https://github.com/BostjanOb/SolrClient

Apache SOLR client for ZF2

  Sources   Download

MIT

The Requires

 

The Development Requires

zf2 module solr