2017 © Pedro PelĂĄez
 

library php-azure-search

PHP wrapper to query Microsoft Azure Search REST API

image

crassaert/php-azure-search

PHP wrapper to query Microsoft Azure Search REST API

  • Thursday, November 19, 2015
  • by crassaert
  • Repository
  • 1 Watchers
  • 2 Stars
  • 2,108 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 1 % Grown

The README.md

php-azure-search-indexer

PHP wrapper to query Microsoft Azure Search REST API by Cédric Rassaert., (*1)

It's strongly recommended to have a Microsoft SQL Server or Azure DocumentDB as data source., (*2)

Basic Usage

New search instance :, (*3)

$search = new AzureSearch(AZURE_SEARCH_HOST, AZURE_SEARCH_KEY);, (*4)

with :, (*5)

AZURE_SEARCH_HOST = https://[service name].search.windows.net
AZURE_SEARCH_KEY = Admin key provided by Azure

Add a datasource

Feel free to use your Microsoft SQL or DocumentDB host., (*6)

$search->getSourceRequest()->createSource('actions', 
            array('name' => 'my_source',
                  'type' => 'documentdb', // azuresql or documentdb
                  'credentials' => array('connectionString' => AZURE_DB_CONNECT_STRING),
                  'container' => array('name' => AZURE_DB_CONTAINER_NAME)));

Add an index

You can add many fields into your index, (*7)

$fields = array();
$fields[] = array('name' => 'id', 'type' => 'Edm.String', 'key' => true);
$fields[] = array('name' => 'name', 'type' => 'Edm.String', 'key' => false);

$search->getIndexRequest()->createIndex('my_index',
            array('name' => 'my_index',
            'fields' => $fields));

Add an indexer

$search->getIndexerRequest()->updateIndexer('actions', 
            array(
                'name' => 'actions',
                'dataSourceName' => 'my_source',
                'targetIndexName' => 'my_index',
                'schedule' => array('interval' => 'PT30M', 
                                    'startTime' => date('c')
                                    )
                ));

Searching

$data = $search->getDocumentRequest()->searchDocument('my_index',
            array(
                'search' => 'my search string'
                )
            );

You can find all options on Microsoft Azure Website, (*8)

The Versions

19/11 2015

dev-master

9999999-dev

PHP wrapper to query Microsoft Azure Search REST API

  Sources   Download

GPL-3.0

The Development Requires

by Cédric Rassaert

17/11 2015

dev-dev

dev-dev

PHP wrapper to query Microsoft Azure Search REST API

  Sources   Download

GPL-3.0

The Development Requires

by Cédric Rassaert