You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Tony Wang <iv...@gmail.com> on 2008/12/27 01:05:15 UTC

PHP interface with Solr

I would like to use PHP to send the query to Solr and will parse the results
in XML. I read this article wiki here
http://wiki.apache.org/solr/SolPHP?highlight=(PHP), but don't quite
understand how to add *the PHP* response formatter to Solr.
SOLR-196<https://issues.apache.org/jira/browse/SOLR-196>has a patch
file that I don't know how to apply it to Solr. Could someone
help me on this pls?

Thanks!

Tony

-- 
Signature: Success is a journey that never ends.

Re: PHP interface with Solr

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Aha, it's "phps" and not "php".  Why that "s"?

 
Otis
--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch



----- Original Message ----
> From: Erik Hatcher <er...@ehatchersolutions.com>
> To: solr-user@lucene.apache.org
> Sent: Saturday, December 27, 2008 5:15:37 AM
> Subject: Re: PHP interface with Solr
> 
> And there other options too.  JSON is a great way to digest data into PHP also.  
> When in PHP, I'd shy away from XML, and use &wt=phps (not php) or &wt=json.
> 
>     Erik
> 
> On Dec 27, 2008, at 1:57 AM, Tony Wang wrote:
> 
> > Now I've found out that there are two options for retrieving the search
> > results:
> > 
> > 1. use curl and parse the search results in XML format?
> > 
> > 2. use PHP response format to output the search results to arrays, as
> > mention in this tutorial http://wiki.apache.org/solr/SolPHP
> > 
> > I wonder which one is better? I am not an expert in PHP programming anyway.
> > 
> > Thanks guys
> > 
> > On Fri, Dec 26, 2008 at 11:24 PM, Ryan McKinley wrote:
> > 
> >> the url you type has some * in it, make sure they are removed:
> >> 
> >> &*wt=php*&hl
> >>> 
> >> 
> >> 
> >> also, try adding echoParams=EXPLICIT and make sure the params you are
> >> passing get parsed ok.
> >> 
> >> ryan
> >> 
> >> 
> >> 
> >> 
> >> On Dec 26, 2008, at 8:00 PM, Tony Wang wrote:
> >> 
> >> Otis,
> >>> 
> >>> Thanks.
> >>> 
> >>> So I can do the search like this:
> >>> 
> >>> 
> http://208.64.71.46:8983/solr/select?q=RC&start=0&rows=10&fl=title%2Curl%2Cscore&qt=standard&
> >>> *wt=php*&hl=on&hl.fl=content
> >>> 
> >>> I tried this link on my server (see above IP), and it gives me an XML
> >>> file.
> >>> I don't have to use PHP response formatter to convert the search results
> >>> to
> >>> arrays? Just read the XML file and outputs the search results? Thanks!
> >>> 
> >>> Tony
> >>> 
> >>> On Fri, Dec 26, 2008 at 7:40 PM, Otis Gospodnetic <
> >>> otis_gospodnetic@yahoo.com> wrote:
> >>> 
> >>> Tony,
> >>>> 
> >>>> If I had to guess, I'd guess that you can get the PHP version of the
> >>>> response by using &wt=php in the URL.  Have you tried that?
> >>>> 
> >>>> 
> >>>> Otis
> >>>> --
> >>>> Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch
> >>>> 
> >>>> 
> >>>> 
> >>>> ----- Original Message ----
> >>>> 
> >>>>> From: Tony Wang 
> >>>>> To: solr-user@lucene.apache.org
> >>>>> Sent: Friday, December 26, 2008 7:05:15 PM
> >>>>> Subject: PHP interface with Solr
> >>>>> 
> >>>>> I would like to use PHP to send the query to Solr and will parse the
> >>>>> 
> >>>> results
> >>>> 
> >>>>> in XML. I read this article wiki here
> >>>>> 
> http://wiki.apache.org/solr/SolPHP?highlight=(PHP)
> >>>>> ,
> >>>>> 
> >>>> but don't quite
> >>>> 
> >>>>> understand how to add *the PHP* response formatter to Solr.
> >>>>> SOLR-196has a patch
> >>>>> file that I don't know how to apply it to Solr. Could someone
> >>>>> help me on this pls?
> >>>>> 
> >>>>> Thanks!
> >>>>> 
> >>>>> Tony
> >>>>> 
> >>>>> --
> >>>>> Signature: Success is a journey that never ends.
> >>>>> 
> >>>> 
> >>>> 
> >>>> 
> >>> 
> >>> --
> >>> Signature: Success is a journey that never ends.
> >>> 
> >> 
> >> 
> > 
> > 
> > --Signature: Success is a journey that never ends.


Re: PHP interface with Solr

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
And there other options too.  JSON is a great way to digest data into  
PHP also.  When in PHP, I'd shy away from XML, and use &wt=phps (not  
php) or &wt=json.

	Erik

On Dec 27, 2008, at 1:57 AM, Tony Wang wrote:

> Now I've found out that there are two options for retrieving the  
> search
> results:
>
> 1. use curl and parse the search results in XML format?
>
> 2. use PHP response format to output the search results to arrays, as
> mention in this tutorial http://wiki.apache.org/solr/SolPHP
>
> I wonder which one is better? I am not an expert in PHP programming  
> anyway.
>
> Thanks guys
>
> On Fri, Dec 26, 2008 at 11:24 PM, Ryan McKinley <ry...@gmail.com>  
> wrote:
>
>> the url you type has some * in it, make sure they are removed:
>>
>> &*wt=php*&hl
>>>
>>
>>
>> also, try adding echoParams=EXPLICIT and make sure the params you are
>> passing get parsed ok.
>>
>> ryan
>>
>>
>>
>>
>> On Dec 26, 2008, at 8:00 PM, Tony Wang wrote:
>>
>> Otis,
>>>
>>> Thanks.
>>>
>>> So I can do the search like this:
>>>
>>> http://208.64.71.46:8983/solr/select?q=RC&start=0&rows=10&fl=title%2Curl%2Cscore&qt=standard&
>>> *wt=php*&hl=on&hl.fl=content
>>>
>>> I tried this link on my server (see above IP), and it gives me an  
>>> XML
>>> file.
>>> I don't have to use PHP response formatter to convert the search  
>>> results
>>> to
>>> arrays? Just read the XML file and outputs the search results?  
>>> Thanks!
>>>
>>> Tony
>>>
>>> On Fri, Dec 26, 2008 at 7:40 PM, Otis Gospodnetic <
>>> otis_gospodnetic@yahoo.com> wrote:
>>>
>>> Tony,
>>>>
>>>> If I had to guess, I'd guess that you can get the PHP version of  
>>>> the
>>>> response by using &wt=php in the URL.  Have you tried that?
>>>>
>>>>
>>>> Otis
>>>> --
>>>> Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch
>>>>
>>>>
>>>>
>>>> ----- Original Message ----
>>>>
>>>>> From: Tony Wang <iv...@gmail.com>
>>>>> To: solr-user@lucene.apache.org
>>>>> Sent: Friday, December 26, 2008 7:05:15 PM
>>>>> Subject: PHP interface with Solr
>>>>>
>>>>> I would like to use PHP to send the query to Solr and will parse  
>>>>> the
>>>>>
>>>> results
>>>>
>>>>> in XML. I read this article wiki here
>>>>> http://wiki.apache.org/solr/SolPHP?highlight=(PHP)<http://wiki.apache.org/solr/SolPHP?highlight=%28PHP%29 
>>>>> >
>>>>> <http://wiki.apache.org/solr/SolPHP?highlight=%28PHP%29>,
>>>>>
>>>> but don't quite
>>>>
>>>>> understand how to add *the PHP* response formatter to Solr.
>>>>> SOLR-196has a patch
>>>>> file that I don't know how to apply it to Solr. Could someone
>>>>> help me on this pls?
>>>>>
>>>>> Thanks!
>>>>>
>>>>> Tony
>>>>>
>>>>> --
>>>>> Signature: Success is a journey that never ends.
>>>>>
>>>>
>>>>
>>>>
>>>
>>> --
>>> Signature: Success is a journey that never ends.
>>>
>>
>>
>
>
> -- 
> Signature: Success is a journey that never ends.


Re: PHP interface with Solr

Posted by Tony Wang <iv...@gmail.com>.
Now I've found out that there are two options for retrieving the search
results:

1. use curl and parse the search results in XML format?

2. use PHP response format to output the search results to arrays, as
mention in this tutorial http://wiki.apache.org/solr/SolPHP

I wonder which one is better? I am not an expert in PHP programming anyway.

Thanks guys

On Fri, Dec 26, 2008 at 11:24 PM, Ryan McKinley <ry...@gmail.com> wrote:

> the url you type has some * in it, make sure they are removed:
>
>  &*wt=php*&hl
>>
>
>
> also, try adding echoParams=EXPLICIT and make sure the params you are
> passing get parsed ok.
>
> ryan
>
>
>
>
> On Dec 26, 2008, at 8:00 PM, Tony Wang wrote:
>
>  Otis,
>>
>> Thanks.
>>
>> So I can do the search like this:
>>
>> http://208.64.71.46:8983/solr/select?q=RC&start=0&rows=10&fl=title%2Curl%2Cscore&qt=standard&
>> *wt=php*&hl=on&hl.fl=content
>>
>> I tried this link on my server (see above IP), and it gives me an XML
>> file.
>> I don't have to use PHP response formatter to convert the search results
>> to
>> arrays? Just read the XML file and outputs the search results? Thanks!
>>
>> Tony
>>
>> On Fri, Dec 26, 2008 at 7:40 PM, Otis Gospodnetic <
>> otis_gospodnetic@yahoo.com> wrote:
>>
>>  Tony,
>>>
>>> If I had to guess, I'd guess that you can get the PHP version of the
>>> response by using &wt=php in the URL.  Have you tried that?
>>>
>>>
>>> Otis
>>> --
>>> Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch
>>>
>>>
>>>
>>> ----- Original Message ----
>>>
>>>> From: Tony Wang <iv...@gmail.com>
>>>> To: solr-user@lucene.apache.org
>>>> Sent: Friday, December 26, 2008 7:05:15 PM
>>>> Subject: PHP interface with Solr
>>>>
>>>> I would like to use PHP to send the query to Solr and will parse the
>>>>
>>> results
>>>
>>>> in XML. I read this article wiki here
>>>> http://wiki.apache.org/solr/SolPHP?highlight=(PHP)<http://wiki.apache.org/solr/SolPHP?highlight=%28PHP%29>
>>>> <http://wiki.apache.org/solr/SolPHP?highlight=%28PHP%29>,
>>>>
>>> but don't quite
>>>
>>>> understand how to add *the PHP* response formatter to Solr.
>>>> SOLR-196has a patch
>>>> file that I don't know how to apply it to Solr. Could someone
>>>> help me on this pls?
>>>>
>>>> Thanks!
>>>>
>>>> Tony
>>>>
>>>> --
>>>> Signature: Success is a journey that never ends.
>>>>
>>>
>>>
>>>
>>
>> --
>> Signature: Success is a journey that never ends.
>>
>
>


-- 
Signature: Success is a journey that never ends.

Re: PHP interface with Solr

Posted by Ryan McKinley <ry...@gmail.com>.
the url you type has some * in it, make sure they are removed:

> &*wt=php*&hl


also, try adding echoParams=EXPLICIT and make sure the params you are  
passing get parsed ok.

ryan



On Dec 26, 2008, at 8:00 PM, Tony Wang wrote:

> Otis,
>
> Thanks.
>
> So I can do the search like this:
> http://208.64.71.46:8983/solr/select?q=RC&start=0&rows=10&fl=title%2Curl%2Cscore&qt=standard&
> *wt=php*&hl=on&hl.fl=content
>
> I tried this link on my server (see above IP), and it gives me an  
> XML file.
> I don't have to use PHP response formatter to convert the search  
> results to
> arrays? Just read the XML file and outputs the search results? Thanks!
>
> Tony
>
> On Fri, Dec 26, 2008 at 7:40 PM, Otis Gospodnetic <
> otis_gospodnetic@yahoo.com> wrote:
>
>> Tony,
>>
>> If I had to guess, I'd guess that you can get the PHP version of the
>> response by using &wt=php in the URL.  Have you tried that?
>>
>>
>> Otis
>> --
>> Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch
>>
>>
>>
>> ----- Original Message ----
>>> From: Tony Wang <iv...@gmail.com>
>>> To: solr-user@lucene.apache.org
>>> Sent: Friday, December 26, 2008 7:05:15 PM
>>> Subject: PHP interface with Solr
>>>
>>> I would like to use PHP to send the query to Solr and will parse the
>> results
>>> in XML. I read this article wiki here
>>> http://wiki.apache.org/solr/SolPHP?highlight=(PHP)<http://wiki.apache.org/solr/SolPHP?highlight=%28PHP%29 
>>> >,
>> but don't quite
>>> understand how to add *the PHP* response formatter to Solr.
>>> SOLR-196has a patch
>>> file that I don't know how to apply it to Solr. Could someone
>>> help me on this pls?
>>>
>>> Thanks!
>>>
>>> Tony
>>>
>>> --
>>> Signature: Success is a journey that never ends.
>>
>>
>
>
> -- 
> Signature: Success is a journey that never ends.


Re: PHP interface with Solr

Posted by Tony Wang <iv...@gmail.com>.
Otis,

Thanks.

So I can do the search like this:
http://208.64.71.46:8983/solr/select?q=RC&start=0&rows=10&fl=title%2Curl%2Cscore&qt=standard&
*wt=php*&hl=on&hl.fl=content

I tried this link on my server (see above IP), and it gives me an XML file.
I don't have to use PHP response formatter to convert the search results to
arrays? Just read the XML file and outputs the search results? Thanks!

Tony

On Fri, Dec 26, 2008 at 7:40 PM, Otis Gospodnetic <
otis_gospodnetic@yahoo.com> wrote:

> Tony,
>
> If I had to guess, I'd guess that you can get the PHP version of the
> response by using &wt=php in the URL.  Have you tried that?
>
>
> Otis
> --
> Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch
>
>
>
> ----- Original Message ----
> > From: Tony Wang <iv...@gmail.com>
> > To: solr-user@lucene.apache.org
> > Sent: Friday, December 26, 2008 7:05:15 PM
> > Subject: PHP interface with Solr
> >
> > I would like to use PHP to send the query to Solr and will parse the
> results
> > in XML. I read this article wiki here
> > http://wiki.apache.org/solr/SolPHP?highlight=(PHP)<http://wiki.apache.org/solr/SolPHP?highlight=%28PHP%29>,
> but don't quite
> > understand how to add *the PHP* response formatter to Solr.
> > SOLR-196has a patch
> > file that I don't know how to apply it to Solr. Could someone
> > help me on this pls?
> >
> > Thanks!
> >
> > Tony
> >
> > --
> > Signature: Success is a journey that never ends.
>
>


-- 
Signature: Success is a journey that never ends.

Re: PHP interface with Solr

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Tony,

If I had to guess, I'd guess that you can get the PHP version of the response by using &wt=php in the URL.  Have you tried that?


Otis
--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch



----- Original Message ----
> From: Tony Wang <iv...@gmail.com>
> To: solr-user@lucene.apache.org
> Sent: Friday, December 26, 2008 7:05:15 PM
> Subject: PHP interface with Solr
> 
> I would like to use PHP to send the query to Solr and will parse the results
> in XML. I read this article wiki here
> http://wiki.apache.org/solr/SolPHP?highlight=(PHP), but don't quite
> understand how to add *the PHP* response formatter to Solr.
> SOLR-196has a patch
> file that I don't know how to apply it to Solr. Could someone
> help me on this pls?
> 
> Thanks!
> 
> Tony
> 
> -- 
> Signature: Success is a journey that never ends.