Skip to content

Instantly share code, notes, and snippets.

@daniel-dgi
Last active August 25, 2016 21:03
Show Gist options
  • Save daniel-dgi/6001819 to your computer and use it in GitHub Desktop.
Save daniel-dgi/6001819 to your computer and use it in GitHub Desktop.
Indexing ancestors for islandora_collection_search module.
<!-- In your demoFoxmlToSolr.xslt, do this! -->
<!-- Put this with the rest of your includes -->
<xsl:include href="/path/to/islandora_transforms/hierarchy.xslt"/>
<!-- Then put this in your main template -->
<xsl:variable name="ancestors">
<xsl:call-template name="get-ancestors">
<xsl:with-param name="PID" select="/foxml:digitalObject/@PID" />
</xsl:call-template>
</xsl:variable>
<xsl:for-each select="xalan:nodeset($ancestors)//sparql:obj">
<xsl:if test="@uri != concat('info:fedora/', $PID)">
<field name="ancestors_ms"><xsl:value-of select="substring-after(@uri, '/')"/></field>
</xsl:if>
</xsl:for-each>
@mjordan
Copy link

mjordan commented Mar 6, 2016

Also, at the top of foxmlToSolr.xslt, where you see this:

xmlns:java="http://xml.apache.org/xalan/java">
  <!--  Used for indexing other objects.
  xmlns:sparql="http://www.w3.org/2001/sw/DataAccess/rf1/result"
  xmlns:xalan="http://xml.apache.org/xalan"> -->

uncomment the last two lines and remove the closing > in the third last line:

  xmlns:java="http://xml.apache.org/xalan/java"
  xmlns:sparql="http://www.w3.org/2001/sw/DataAccess/rf1/result"
  xmlns:xalan="http://xml.apache.org/xalan">

@ajstanley
Copy link

Should probably be
<!-- In your foxmlToSolr.xslt, do this! -->

@mshort
Copy link

mshort commented Aug 25, 2016

Like with the namespaces, traverse-graph.xslt also needs to be uncommented in foxmlToSolr.xslt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment