简体   繁体   English

在heroku上使用solr / websolr获得单数和复数搜索词的不同结果

[英]getting different results for singular and plural search terms with solr/websolr on heroku

I have sunspot solr/websolr on heroku. 我在heroku上有sunspot solr / websolr。 I have set this in my solr/conf/schema.xml 我已经在我的solr / conf / schema.xml中设置了它

<filter class="solr.PhoneticFilterFactory" encoder="DoubleMetaphone" inject="true"/>

Like so 像这样

<fieldType name="text" class="solr.TextField" omitNorms="false">
  <analyzer>
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.StandardFilterFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.PorterStemFilterFactory"/>
    <filter class="solr.PhoneticFilterFactory" encoder="DoubleMetaphone" inject="true"/>
  </analyzer>
</fieldType>

On dev if I search for "chair" or "chairs" I get she same results. 在dev上,如果我搜索“ chair”或“ chairs”,我得到的结果是相同的。 If I do the same search on staging or prod I get different results for each search term. 如果我对阶段或产品进行相同的搜索,则每个搜索词都会得到不同的结果。 I have restarted and reindexed solr. 我已经重新启动并为solr重新编制了索引。

What else would I need to do? 我还需要做什么?

Websolr support here. Websolr支持在这里。 From your description, I see some red flags that usually indicate some confusion over how websolr integrates with your app. 从您的描述中,我看到一些红色标记,通常表示对websolr如何与您的应用程序集成感到困惑。 Sunspot comes bundled with a version of Solr that can be run locally, however Heroku does not support users spinning up their own Solr instance. Sunspot捆绑了可以在本地运行的Solr版本,但是Heroku不支持用户自行创建自己的Solr实例。 So commands like bundle exec rake sunspot:solr:start don't actually do anything. 因此,诸如bundle exec rake sunspot:solr:start类的命令实际上并不执行任何操作。 True, it will work on a local environment, but it won't work on Heroku. 没错,它将在本地环境下运行,但在Heroku上将无法运行。 Similarly, modifying solr/conf/schema.xml will apply to a locally-hosted Solr instance, but will have no effect on your websolr index. 同样,修改solr / conf / schema.xml将应用于本地托管的Solr实例,但不会影响您的websolr索引。

Try running heroku addons:open websolr to open up the websolr dashboard. 尝试运行heroku addons:open websolr以打开websolr仪表板。 This should show you the index(es) in your account. 这应该显示您帐户中的索引。 Click on your index to see its status. 单击您的索引以查看其状态。 You should see a link called "Advanced Configuration." 您应该看到一个名为“高级配置”的链接。 Clicking on this will take you to your schema. 单击此按钮将带您进入架构。 Check on this schema and make sure it has the definitions you posted above. 检查此架构,并确保它具有您在上面发布的定义。

If you need to make any changes to the schema, then you'll need to reindex. 如果您需要对架构进行任何更改,则需要重新索引。 Run heroku rake sunspot:reindex to add the documents to your websolr index. 运行heroku rake sunspot:reindex sunspot heroku rake sunspot:reindex将文档添加到您的websolr索引中。 That should be good. 那应该很好。

If you have other issues, send us an email at support at onemorecloud.com and we'll walk you through it. 如果您还有其他问题,请发送电子邮件support at onemorecloud.com ,我们将support at onemorecloud.com您。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM