Solr搜索建议


8

我已经在Tomcat上安装了Solr服务器,并且基本工作正常-但我根本无法获得任何建议或建议。(Magento Enterprise 1.14.01和Solr 3.6.2)

如果我使用从Magento发送到Solr的GET字符串并在浏览器中运行它,我会看到基本结果-但没有任何建议。

但是,如果我从Tomcat看日志,则Solr服务器正在处理,并且知道应该返回的建议...但是它们不会在响应json中发送回去。

例:

我发给Solr的东西

http://dev.samplesite.com:8080/solr/select?sort=score+desc&stats=true&stats.field=price_0_1&qt=magento_en&fq=%28visibility%3A3+OR+visibility%3A4%29+AND+store_id%3A1&version=1.2&wt=json&json.nl=map&q=bluu&start=0&rows=0

我从Solr得到的回报

{"responseHeader":{"status":0,"QTime":185,"params":{"sort":"score desc","start":"0","stats.field":"price_0_1","stats":"true","q":"bluu","json.nl":"map","qt":"magento_en","wt":"json","fq":"(visibility:3 OR visibility:4) AND store_id:1","rows":"0","version":"1.2"}},"response":{"numFound":0,"start":0,"docs":[]},"stats":{"stats_fields":{"price_0_1":null}}}

但是在Solr日志中,我看到这两行

Jun 02, 2014 8:49:09 PM org.apache.solr.core.SolrCore execute
INFO: [] webapp=/solr path=/select params={sort=score+desc&json.nl=map&wt=json&rows=1&version=1.2&fl=id&start=0&q=blue&qt=magento_en&fq=(visibility:3+OR+visibility:4)+AND+store_id:1} hits=1405 status=0 QTime=1 
Jun 02, 2014 8:49:09 PM org.apache.solr.core.SolrCore execute
INFO: [] webapp=/solr path=/select params={sort=score+desc&json.nl=map&wt=json&rows=1&version=1.2&fl=id&start=0&q=bleu&qt=magento_en&fq=(visibility:3+OR+visibility:4)+AND+store_id:1} hits=1 status=0 QTime=8 

Solr清楚地知道“ blue”具有1405个结果,而“ bleu”具有1个结果...这对于我们的目录是准确的-但某些方面使这些建议无法通过JSON字符串发送回Magento

我正在使用由Magento在apache lib文件夹中创建的示例中的默认solrconfig.xml(以及其他conf文件)。

在Solr的Magento配置中:

Enable Search Suggestions? Yes
Search Suggestion Count? 2
Show Results Count for Each Suggestion? Yes
Enable Search Recommendations? Yes
Search Recommendations Count? 5

我觉得我缺少一些非常简单的东西...有什么建议吗?


你有解决过这个吗?
David Manners 2014年

我们尚未解决问题
Mark Middleton 2014年

Answers:


2

将这两个模板文件复制到您的主题

- enterprise/default/template/search/suggestions.phtml
- enterprise/default/template/search/recommendations.phtml

并确保在catalogsearch.xml文件中指定了这些

 <catalogsearch_result_index translate="label">
       ......
        <reference name="content">
            <block type="core/text_list" name="additional" translate="label">
                        <label>Additional Info</label>
                        <block type='enterprise_search/suggestions' name='search_suggestions' template="search/suggestions.phtml"></block>
                        <block type='enterprise_search/recommendations' name='search_recommendations' template="search/recommendations.phtml"></block>
                    </block>
            ........
        </reference>
    </catalogsearch_result_index>

注意:作为一项快速测试,您可以切换到默认的企业主题,并查看(Solr)建议和建议是否出现在搜索结果页面中。如果是这样的话,以上更改绝对适用于您当前的主题。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.