如何在PHP PECL扩展中启用solr拼写检查器或建议器

时间:2015-07-30 14:01:05

标签: php solr pecl

我在manual中找不到有关启用拼写检查器组件或建议器的任何条目。我可以通过POST获得法术建议

http://localhost:8112/solr/collection/spell?q=Citiz&wt=json&indent=true&spellcheck=true&spellcheck.collate=true

但是如何使用带有扩展名的拼写检查程序?

1 个答案:

答案 0 :(得分:1)

我自己找到了解决方案。我希望有关于此扩展的更详细的教程。

   $client = new SolrClient($option);

   $client->setServlet(SolrClient::SEARCH_SERVLET_TYPE,'spell');

   $solrQuery  = new SolrQuery();

   $solrQuery->set('spellcheck','true');

   $solrQuery->setQuery($term);

   $query_response = $client->query($solrQuery);

   $data = $query_response->getResponse();