从 Solr 检索 Magento 产品信息
我正在开发一个应用程序,我们需要 Magento 将所有产品推送到 solr,以便我们可以直接从那里检索它们。这意味着我们使用 Solr REST API 来检索 Magento 推送的产品。
我按照此处描述的步骤操作: http://www.summasolutions.net/blogposts/ magento-apache-solr-integration
设置工作正常,产品被推送到 solr,我可以按预期通过 REST API 检索它们。然而,我可以从 solr 检索的唯一字段是:状态、时间戳、store_id、id、short_description、sku、价格、名称、in_stock、description_en、fulltext_en、attr_select_tax_class_id、attr_select_status。
根据 schemas.xml,我应该能够获得以下附加字段:“visibility”、“show_in_categories”、“categories”。
不幸的是,情况并非如此。我什至将属性stored=“true”添加到这些字段中,但没有任何可见的结果。问题是,如何让这些字段显示在搜索结果中?我的查询通常如下所示:
http://solr:8983/solr/select/?q=*:*&version=2.2&start=0&rows=10&indent=on
此外,我想检索其他 Magento 属性(例如自定义设计、产品标签、产品评论等)。有办法做到这一点吗?
谢谢。 最大限度。
I'm working on an application where we need Magento to push all products to solr so we can retrieve them directly from there. That means we use the Solr REST API to retrieve products that have been pushed by Magento.
I followed the steps described here: http://www.summasolutions.net/blogposts/magento-apache-solr-integration
The settings work fine, the products are pushed to solr and I can retrieve them via the REST API as expected. The only fields, however that i can retrieve from solr are: status, timestamp, store_id, id, short_description, sku, price, name, in_stock,description_en, fulltext_en, attr_select_tax_class_id, attr_select_status.
According to the schemas.xml, I should be able to get the following additional fields: "visibility", "show_in_categories", "categories".
Unfortunately this is not the case. I even added the attribiute stored="true" to these fields, without any visible result. The question is, how do I make these fields show up in the search results? My query typically looks as follows:
http://solr:8983/solr/select/?q=*:*&version=2.2&start=0&rows=10&indent=on
In addition, I would like to retrieve other Magento attributes (e.g. custom design, product tags, product reviews, etc.). Is there a way this can be done?
thanks.
Max.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Magento 只会索引 Solr 中可搜索并在产品列表中使用的属性。这意味着所有不要搜索的产品属性(不是快速搜索,也不是高级搜索)将不会在 Solr 中建立索引。
如果您想向索引添加特定属性,可以使它们可搜索。为此,请登录到您的管理面板并执行以下操作:
不幸的是 Magento有时只会索引引用而不是实际值本身。因此,除非您在 Magento 中加载索引,否则某些信息可能没有用。我们目前正在使用 Solr 索引,借助 Search API、Search API Solr 和 Sarnia 在 Drupal 中启用 Magento 产品搜索,这就是我们想要修改索引属性的原因,但是有时只有引用会使输出变得复杂。
Magento will only index attributes within Solr which are searchable and used in product listing. This means that all the product attributes which are not meant to be searched (not in quick search, nor advanced search) will not be indexed within Solr.
If you want to add specific attributes to the index, you can make them searchable. To do so, login into your administration panel and do the following:
Unfortunately Magento will sometimes index only references and not the actual values itself. So unless you are loading the index within Magento, some of the information might not be useful. We are currently using the Solr index to enable a Magento product search within Drupal with the help of Search API, Search API Solr and Sarnia, which is the reason we wanted to modify which attributes are indexed, however having sometimes only references complicates the output.
为了检索字段,您需要使用 fl 参数。
fl 参数控制将随响应返回的字段。
尝试
fl=*
这将返回标记为已存储的所有字段。您可以通过单独放置字段来自定义字段。
In order to retrieve the fields, you need to use the fl parameter.
fl parameter controls the fields which would be returned back with the response.
Try
fl=*
which would return all the fields marked as stored.You can customise the fields by putting them individually.
我解决了部分问题。 Magento 中的配置显示该产品没有库存。因此,字段“visibility”、“show_in_categories”、“categories”.where 未显示在 solr 中。将产品设置为有库存后,它们现在就会出现。
我的问题的第二部分仍然没有得到解答:如何让图像、url、关键字等字段显示在 solr 中?使用 SOAP,产品中包含更多字段。我正在尝试将所有这些都放入 solr 中。任何意见将不胜感激。
I solved part of the problems. The configuration in Magento showed that the product is not in stock. As a result the fields "visibility", "show_in_categories", "categories".where not showing up in solr. After setting the products as in stock, they now appear.
The second part of my question remains unanswered: how do i get fields such as image, url, keywords to show up in solr? Using SOAP, there are much more fields that are included in a product. I'm trying to get all these into solr. Any input would be much appreciated.