从 Solr 检索 Magento 产品信息

发布于 2024-12-11 15:26:52 字数 870 浏览 0 评论 0原文

我正在开发一个应用程序,我们需要 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

神妖 2024-12-18 15:26:52

Magento 只会索引 Solr 中可搜索并在产品列表中使用的属性。这意味着所有要搜索的产品属性(不是快速搜索,也不是高级搜索)将不会在 Solr 中建立索引。

如果您想向索引添加特定属性,可以使它们可搜索。为此,请登录到您的管理面板并执行以下操作:

  1. 转到目录 ->属性->管理属性
  2. 选择要在 Solr 中建立索引的属性,然后单击它
  3. 在“前端属性”下,将“在高级搜索中使用”和“在产品列表中使用”设置为“是”
  4. 转到索引管理,然后重新创建索引

不幸的是 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:

  1. Go to Catalog -> Attributes -> Manage Attributes
  2. Select the attribute(s) you want to index within Solr and click on it
  3. Under "Frontend Properties" set "Use in Advanced Search" and "Used in Product Listing" to Yes
  4. Go to Index Management, and recreate the indices

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.

谎言月老 2024-12-18 15:26:52

为了检索字段,您需要使用 fl 参数

fl 参数控制将随响应返回的字段。
尝试 fl=* 这将返回标记为已存储的所有字段。

http://solr:8983/solr/select/?q=*:*&version=2.2&start=0&rows=10&indent=on&fl=*

您可以通过单独放置字段来自定义字段。

fl=visibility,show_in_categories,categories

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.

http://solr:8983/solr/select/?q=*:*&version=2.2&start=0&rows=10&indent=on&fl=*

You can customise the fields by putting them individually.

fl=visibility,show_in_categories,categories
深海夜未眠 2024-12-18 15:26:52

我解决了部分问题。 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文