search - Integrating Solr using PHP -
i wanted use solr in order enable learning management service package have search features. read , tried out official tutorial here: http://lucene.apache.org/solr/4_3_0/tutorial.html. , here: http://wiki.apache.org/solr/integratingsolr
what should use: solphp or kophp
however, couldn't think how integrate solr php package.
what files have include in package , modifications need enable solr indexing , search?
any help/post/relevant tutorial helpful.
1.download , install php web server(xampp)
2.set php path in envirement varibale(c:\xampp\php)
3.downlaod , install composer (change compatibilty if program crasshed )
4.open file "c:\xampp\php\php.ini" , uncomment extension=php_curl.dll , extension=php_openssl.dll
5.when composer install succesfully(c:\programdata\composer\bin) there composer.phar file available or download composar.phar file
6.open command prompt , goto composer.phar file path ,create file name composer.json (php composar.phar init)
#microsoft windows [version 6.2.9200] (c) 2012 microsoft corporation. rights reserved. c:\users\rkj>cd c:\programdata\composer\bin c:\programdata\composer\bin>php composer.phar init welcome composer config generator command guide through creating composer.json config. package name (<vendor>/<name>) [rkj/bin]: a/b description []: author: minenter code hereimum stability []: license []: define dependencies. define dependencies (require) interactively [yes]? no define dev dependencies (require-dev) interactively [yes] ? no { "name": "a/b", "require": { } } confirm generation [yes]? yes
then edit composer.json file , update require feild "solarium/solarium": "3.0.0"
or save file composer.json { "name": "rkj/abc", "require": { "solarium/solarium": "3.0.0" } }
7.type >>php composer.phar install vendor foler available in path
8.copy vandor folder php workspace(c:\xampp\htdocs) , check using following script
<?php $config = array( 'endpoint' => array( 'localhost' => array( 'host' => 'localhost', 'port' => '8080', 'path' => '/solr/collection1/select? q=*%3a*&wt=json&indent=true' ) ) ); // new solarium client object include(__dir__ . '/vendor/autoload.php'); $client = new solarium\client($config); print('helllo<br>'); $ping = $client->createping(); // execute ping query try{ $result = $client->ping($ping); echo 'ping query successful'; echo '<br/><pre>'; var_dump($result->getdata()); }catch(solarium\exception $e){ echo 'ping query failed'; } ?>
Comments
Post a Comment