2

I have solr on my local machine and its working fine when I am hitting this url:

http://localhost:8983/solr/

but I am new in solr search and I don't know how to configure PHP and MySQL with Solr.

I am using windows8 and solr5.1.0. If any one have command in solr+php+mysql then please suggest.

kenorb
  • 155,785
  • 88
  • 678
  • 743
alok
  • 2,718
  • 21
  • 17
  • 1
    Could you able to make queries to your Solr from the address bar of your web browser? – SaidbakR May 17 '15 at 12:20
  • See: [Using Solarium with SOLR for Search – Solarium and GUI](http://www.sitepoint.com/using-solarium-solr-search-solarium-gui/) and [Solarium Project](http://www.solarium-project.org/). – kenorb May 19 '15 at 11:17
  • @alok Asking for tutorials is off-topic. Your question is too broad and opinion based. You should ask some specific question only (about programming). If you're beginner, you can consider using Drupal, it should be much easier. See: [Apache Solr installation and compatibility with Drupal 7](http://drupal.stackexchange.com/q/95897/1908). – kenorb May 19 '15 at 11:27
  • I am a magento developer not a drupal deloper. Is there any link for magento then please share.... – alok May 20 '15 at 09:41

1 Answers1

4

Simply and mainly you will need two native PHP functions:

Here are a simple custom function in which you have to supply it with full URL query to your Solr such as http://localhost:8080/solr/wak/select?q=SearchPool%3Aالصلاة&wt=json&indent=true of course it changed depending on your schema and the requirements of query.

function readQuery($q){     
        $data = file_get_contents($q);
        return json_decode($data);
    }

The readQuery function returns a JSON object, notice wt=json in the URL, with the query results. For debugging and knowing how to access the objects properties you may use var_dump.

SaidbakR
  • 13,303
  • 20
  • 101
  • 195