ruby-on-railsherokusolrwebsolr

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


I have sunspot solr/websolr on heroku. I have set this in my 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. If I do the same search on staging or prod I get different results for each search term. I have restarted and reindexed solr.

What else would I need to do?


Solution

  • Websolr support here. From your description, I see some red flags that usually indicate some confusion over how websolr integrates with your app. 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. So commands like bundle exec rake sunspot:solr:start don't actually do anything. True, it will work on a local environment, but it won't work on Heroku. Similarly, modifying solr/conf/schema.xml will apply to a locally-hosted Solr instance, but will have no effect on your websolr index.

    Try running heroku addons:open websolr to open up the websolr dashboard. 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. 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.