« Reason why Islandora could not connect to SOLR on stage | Main | Finding all the collections a DSPACE item belongs to »

Bill's Solution to the Solr problem

We had problems connecting SOLR to Drupal. Here are some answers that Bill Tantzen found:

Some issues with bad characters

Hex values should be inserted in the solr REST call:
http://128.101.146.59:8080/solr/select/?version=1.2&start=0&rows=10&indent=on&wt=standard&q=fullText:food&sort=modstitle desc&qt=mods

Should be:

http://128.101.146.59:8080/solr/select/?version=1.2&start=0&rows=10&indent=on&wt=standard&q=fullText:food++%26sort%3Dmodstitle%2Bdesc&qt=mods

Fields that Solr searches on should be single valued

Bill found out that fields that are being used for sort must be single values. Our title field is not. In the past SOLR would handle multivalued fields for sort.

The MODS schema

	<titleInfo>
 	 	<title>[dc.title]</title>
 	</titleInfo>
<titleInfo type="translated">
 	 	<title>[dc.title.alternative]</title>
 	</titleInfo>

The XSLT to make SOLR indices

Note the XSLT will not distinguish between different values of the type attribute, so there is more than version of title, it will no longer be single valued.
/Users/birage/fedora/tomcat/webapps/fedoragsearch/WEB-INF/classes/config/index/GSearch_solr/demoFoxmlToSolr.xslt  

    <xsl:for-each select="foxml:datastream[@ID='MODS']/foxml:datastreamVersion[last()]/foxml:xmlContent//mods:titleInfo/mods:title">
         <xsl:if test="text() [normalize-space(.) ]"><!--don't bother with empty space-->
            <field>./WEB-INF/classes/config/index/GSearch_solr/demoFoxmlToSolr.xslt
               <xsl:attribute name="name">
                  <xsl:value-of select="concat('mods.', 'title')"/>
               </xsl:attribute>
               <xsl:value-of select="text()"/>
            </field>
         </xsl:if>
      </xsl:for-each>

Possible values for the type attribute of title element in MODS

From: http://www.loc.gov/standards/mods/v3/mods-userguide-elements.html
type - This attribute is applied when it is necessary to identify what type of title is recorded.
For the main title (MARC 21 field 245), no type is indicated. The following values may be used with the type attribute:
abbreviated (equivalent to MARC 21 field 210)
translated (equivalent to MARC 21 field 242, 246)
alternative (equivalent to MARC 21 fields 246, 740)
uniform (equivalent to MARC 21 fields 130, 240, 730)

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)