lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rachun <rachun.c...@gmail.com>
Subject PHP Solr Client - spellchecker
Date Tue, 11 Mar 2014 08:40:54 GMT
Dear all gurus,


I'm having problem with trying to use spell checker for my suggestion and
I'm using PHP Solr client. So I tried to code like this
===================PHP===================

$config = array
        (
            'hostname'  => 'localhost',
            'port'      => '8983',
            'path'      => 'solr'
        );

$q='macbook';
$client = new SolrClient($config);
$query = new SolrQuery();
$query->setQuery($q);
$query->addParam("shards.qt","/spell");
$query->addParam("fl","product_name_th");

$query_response = $client->query($query);
$result = $query_response->getResponse();

print_r($result);

======================== Result =============

SolrObject Object
(
    [responseHeader] => SolrObject Object
        (
            [status] => 0
            [QTime] => 2
            [params] => SolrObject Object
                (
                    [fl] => product_name_th
                    [indent] => on
                    [shards.qt] => /spell
                    [start] => 0
                    [q] => macbook
                    [wt] => xml
                    [rows] => 0
                    [version] => 2.2
                )

        )

    [response] => SolrObject Object
        (
            [numFound] => 4
            [start] => 0
            [docs] => 
        )

)

======================= Solr Log =================

INFO  - 2014-03-11 15:23:48.556; org.apache.solr.core.SolrCore;
[collection1] webapp=/solr path=/select/
params={fl=product_name_th&indent=on&shards.qt=/spell&start=0&q=macbook&wt=xml&rows=0&version=2.2}
hits=4 status=0 QTime=2 
==============================================
At this log you can see it didn't go through my requestHandler named spell
but when I try this


http://localhost:8983/solr/spell?spellcheck=true&qt=spellchecker&spellcheck.accuracy=0.8&spellcheck.collate=true&fl=product_name_th&extendedResults=true+&q=macbook

I get the result like this (which is the way I would love it to be)....

<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">1</int>
</lst>
<result name="response" numFound="4" start="0">

<doc><str name="product_name_th">Macbook Pro</str></doc>
<doc><str name="product_name_th">Macbook air</str></doc>
<doc><str name="product_name_th">กระเป๋าใส่ macbook air</str></doc>
<doc><str name="product_name_th">กระเป๋าใส่ macbook pro</str></doc>

</result>
<lst name="spellcheck">
<lst name="suggestions"><bool
name="correctlySpelled">false</bool></lst></lst>
</response>
======================Solr log========================

INFO  - 2014-03-11 15:34:57.013; org.apache.solr.core.SolrCore;
[collection1] webapp=/solr path=/spell
params={spellcheck=true&extendedResults=true&fl=product_name_th&spellcheck.accuracy=0.8&q=macbook&spellcheck.collate=true&qt=spellchecker}
hits=4 status=0 QTime=2 

At this point I can see that it goes through my requestHandler named spell
================================================

Did I do something wrong?
I really need help.

Thank you very much,
Rachun

 





--
View this message in context: http://lucene.472066.n3.nabble.com/PHP-Solr-Client-spellchecker-tp4122780.html
Sent from the Solr - User mailing list archive at Nabble.com.

Mime
View raw message