Skip to content

Configuration

ghing edited this page Nov 26, 2012 · 3 revisions

Configuration

Note

This is work-in-progress documentation for configuring Storybase and should eventually be merged into the documentation contained in project documentation in the docs subdirectory of the repo. Mostly, these are notes about weird things that need to be configured that can't be documented in example configuration files.

Social Auth

Twitter

You need to create a Twittter API consumer key and secret. When doing this, you must also specify the homepage URL of your instance in the callback URL field, otherwise you'll get a HTTP 401 error when the user tries to complete the Twitter sign up/sign in flow.

Solr

Spelling Suggestions

We make use of Solr's Spell Check Component, and Haystack's Support for it to provide spelling suggestions in search results. However, we need to do some extra configuration in solrconfig.xml in order to use this. Reading the Solr documentation of this feature is recommended, but here are some configuration snippets to get you started.

Configuring the spell check component:

<searchComponent name="spellcheck" class="solr.SpellCheckComponent">

  <str name="queryAnalyzerFieldType">textSpell</str>

  <lst name="spellchecker">
    <!--
      Optional, it is required when more than one spellchecker is configured.
      Select non-default name with spellcheck.dictionary in request handler.
    -->
    <str name="name">default</str>
    <!-- The classname is optional, defaults to IndexBasedSpellChecker -->
    <str name="classname">solr.IndexBasedSpellChecker</str>
    <!--
      Load tokens from the following field for spell checking,
      analyzer for the field's type as defined in schema.xml are used
    -->
    <str name="field">suggestions</str>
    <str name="spellcheckIndexDir">./spellchecker</str>
    <!-- Set the accuracy (float) to be used for the suggestions. Default is 0.5 -->
    <str name="accuracy">0.7</str>
    <!-- Require terms to occur in 1/100th of 1% of documents in order to be included in the dictionary -->
    <float name="thresholdTokenFrequency">.0001</float>
    <str name="buildOnCommit">true</str>
  </lst>
</searchComponent>

Adding the spell check component to the default request handler:

<requestHandler name="standard" class="solr.SearchHandler" default="true">
  <!-- default values for query parameters -->
  <lst name="defaults">
    <str name="echoParams">explicit</str>
    <!--
    <int name="rows">10</int>
    <str name="fl">*</str>
    <str name="version">2.1</str>
    -->
    <str name="spellcheck.dictionary">default</str>
    <!-- omp = Only More Popular -->
    <str name="spellcheck.onlyMorePopular">false</str>
    <!-- exr = Extended Results -->
    <str name="spellcheck.extendedResults">false</str>
    <!--  The number of suggestions to return -->
    <str name="spellcheck.count">1</str>
  </lst>
  <arr name="last-components">
    <str>spellcheck</str>
  </arr>
</requestHandler>

You'll also need to set the INCLUDE_SPELLING entry to True to the HAYSTACK_CONNECTIONS setting in your Django settings module:

HAYSTACK_CONNECTIONS = {
    'default': {
        'ENGINE': 'storybase_geo.search.backends.Solr2155Engine',
        'URL': 'http://127.0.0.1:8080/solr3',
        'INCLUDE_SPELLING': True,
    },
}

Clone this wiki locally