How to use SolrQuery PHP

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to use SolrQuery PHP

Tiong Jeffrey
Hi all,

I am trying to send a query to Solr from my PHP script and retrieve the
results. I found this script on the wiki http://wiki.apache.org/solr/SolPHP

I tried to use it but I guess I didn't use it correctly, there wasn't any
result appear (blank). Below is my simple code to use the Solrquery class.

               $query = new SolrQuery;

                $query->limit = 10;
                $query->group_id = 1;

                $results = $query->runQuery(water);
                echo $results;

Can anyone tell me what is wrong with this? And if there is any other way to
do this? Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: How to use SolrQuery PHP

Nick Jenkin-2
Hi Tiong
My suggestion would be to write your own using the SolrQuery script as a guide.

But did you change define('SOLR_META_QUERY', '127.0.0.1:8080');
so that it points to your solr server? (Which is most likely
define('SOLR_META_QUERY', 'localhost:8983');

-Nick
On 6/10/07, Tiong Jeffrey <[hidden email]> wrote:

> Hi all,
>
> I am trying to send a query to Solr from my PHP script and retrieve the
> results. I found this script on the wiki http://wiki.apache.org/solr/SolPHP
>
> I tried to use it but I guess I didn't use it correctly, there wasn't any
> result appear (blank). Below is my simple code to use the Solrquery class.
>
>                $query = new SolrQuery;
>
>                 $query->limit = 10;
>                 $query->group_id = 1;
>
>                 $results = $query->runQuery(water);
>                 echo $results;
>
> Can anyone tell me what is wrong with this? And if there is any other way to
> do this? Thanks!
>
Reply | Threaded
Open this post in threaded view
|

Re: How to use SolrQuery PHP

Tiong Jeffrey
Yes I did that. Ya, maybe I should study the code in detailed! Thanks!

On 6/10/07, Nick Jenkin <[hidden email]> wrote:

>
> Hi Tiong
> My suggestion would be to write your own using the SolrQuery script as a
> guide.
>
> But did you change define('SOLR_META_QUERY', '127.0.0.1:8080');
> so that it points to your solr server? (Which is most likely
> define('SOLR_META_QUERY', 'localhost:8983');
>
> -Nick
> On 6/10/07, Tiong Jeffrey <[hidden email]> wrote:
> > Hi all,
> >
> > I am trying to send a query to Solr from my PHP script and retrieve the
> > results. I found this script on the wiki
> http://wiki.apache.org/solr/SolPHP
> >
> > I tried to use it but I guess I didn't use it correctly, there wasn't
> any
> > result appear (blank). Below is my simple code to use the Solrquery
> class.
> >
> >                $query = new SolrQuery;
> >
> >                 $query->limit = 10;
> >                 $query->group_id = 1;
> >
> >                 $results = $query->runQuery(water);
> >                 echo $results;
> >
> > Can anyone tell me what is wrong with this? And if there is any other
> way to
> > do this? Thanks!
> >
>