Problems with RELS_EXT_isMemberOfCollection Field in Solr config

113 views
Skip to first unread message

Brandon Weigel

unread,
Apr 18, 2016, 2:56:14 PM4/18/16
to islandora
We're trying to include Collection as a Solr facet as well as one of the search result display fields. To accomplish this, I've tried adding the SOLR field RELS_EXT_isMemberOfCollection_uri_s (and other similar versions), with mixed results including at least one bug.

As you can see from the screenshot, the field generates some information that the viewer doesn't need to see (info:fedora), in addition to showing the collection PID rather than the title (even when you check the "Object Label" box in the facet settings).  

Additionally, in the Display Fields area, clicking the link that should take you to a search fielded on that collection results in an error: Error searching Solr index "400" Status: Bad Request
This one, at least, is clearly a bug due to a failure to escape the slash in the generated search string. If you change the "/" to "~slsh~" it works as expected:
Is there a way, out of the box, to show the collection's titleInfo field rather than PID in the facets and the metadata display? Is there simply a different field that I can't find? Any suggestions to get around these problems?

Jared Whiklo

unread,
Apr 18, 2016, 3:39:36 PM4/18/16
to isla...@googlegroups.com
Hi Brandon,

Not sure about out of the box, but we did this by modifying the default
hierarchy.xslt to include a new "collection_title_ms" field which looks
nice to display and works to facet.

It is not super hard, but it really depends on how comfortable you are
messing with XSLTs.

We needed to include the parent objects title[1][2] in the sparql query
results and then add it to the Solr document[3] at indexing time.

This is specific to our display as it only adds this field for objects
that are not collections or newspapers and whose parent are a
collections or a newspaper.

So you would need to play around with it.

cheers,
jared


[1]
https://github.com/uml-digitalinitiatives/UofM_gsearch_config/blob/camel-indexer-xslt/islandora_transforms/hierarchy.xslt#L19
[2]
https://github.com/uml-digitalinitiatives/UofM_gsearch_config/blob/camel-indexer-xslt/islandora_transforms/hierarchy.xslt#L28-L30
[3]
https://github.com/uml-digitalinitiatives/UofM_gsearch_config/blob/camel-indexer-xslt/islandora_transforms/hierarchy.xslt#L66-L68


On 2016-04-18 1:56 PM, Brandon Weigel wrote:
> We're trying to include Collection as a Solr facet as well as one of the
> search result display fields. To accomplish this, I've tried adding the
> SOLR field RELS_EXT_isMemberOfCollection_uri_s (and other similar
> versions), with mixed results including at least one bug.
>
> <https://lh3.googleusercontent.com/-yr_XXih7Elg/VxUrpzeK9MI/AAAAAAAAAAc/Mncq7NRnPqokPxjKviX5NraKhZbnQpxkwCLcB/s1600/Screen%2BShot%2B2016-04-18%2Bat%2B11.43.42%2BAM.png>
>
> As you can see from the screenshot, the field generates some information
> that the viewer doesn't need to see (info:fedora), in addition to
> showing the collection PID rather than the title (even when you check
> the "Object Label" box in the facet settings).
>
> Additionally, in the Display Fields area, clicking the link that should
> take you to a search fielded on that collection results in an
> error: Error searching Solr index "400" Status: Bad Request
> This one, at least, is clearly a bug due to a failure to escape the
> slash in the generated search string. If you change the "/" to "~slsh~"
> it works as expected:
>
> * Generated path:
> http://arcabc.ca/islandora/search/RELS_EXT_isMemberOfCollection_uri_ss%3A%22info%5C%3Afedora%5C/ecuad%5C%3AarchivalPhotos%22
> * Fixed
> path: http://arcabc.ca/islandora/search/RELS_EXT_isMemberOfCollection_uri_ss%3A%22info%5C%3Afedora%5C~slsh~ecuad%5C%3AarchivalPhotos%22
>
> Is there a way, out of the box, to show the collection's titleInfo field
> rather than PID in the facets and the metadata display? Is there simply
> a different field that I can't find? Any suggestions to get around these
> problems?
>
> --
> For more information about using this group, please read our Listserv
> Guidelines: http://islandora.ca/content/welcome-islandora-listserv
> ---
> You received this message because you are subscribed to the Google
> Groups "islandora" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to islandora+...@googlegroups.com
> <mailto:islandora+...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/islandora.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/islandora/db38937a-f6f8-4466-94b9-5c536ed879ff%40googlegroups.com
> <https://groups.google.com/d/msgid/islandora/db38937a-f6f8-4466-94b9-5c536ed879ff%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

--
Jared Whiklo
jwh...@gmail.com
--------------------------------------------------
People are more violently opposed to fur than leather because it's safer
to harass rich women than motorcycle gangs.
0xCE1D1756.asc
signature.asc

Chris Warren

unread,
Apr 18, 2016, 3:40:26 PM4/18/16
to isla...@googlegroups.com
I think we're doing what you're looking for:


The top facet there is Collection, showing the name of the collection.

We implemented this at the foxmlToSolr level. In .../islandora_transforms/RELS-EXT_to_solr.xslt we have:

 <xsl:if test="local-name()='isMemberOfCollection'">
          <xsl:variable name="collectionPID" select="substring-after(@rdf:resource,'info:fedora/')"/>
          <xsl:variable name="collectionContent" select="exts:getDatastreamXML($collectionPID, $REPOSITORYNAME, 'DC', $FEDORASOAP, $FEDORAUSER, $FEDORAPASS, $TRUSTSTOREPATH, $TRUSTSTOREPASS)"/>

          <field name="collection_membership.pid_ms">
            <xsl:value-of select="$collectionPID"/>
          </field>

          <xsl:for-each select="$collectionContent//dc:title">
            <xsl:if test="local-name()='title'">
              <xsl:choose>
               <xsl:when test="java:add($single_valued_hashset_for_rels_ext, 'collection_membership.title_s')">
                 <field name="collection_membership.title_s">
                   <xsl:value-of select="text()"/>
                 </field>
               </xsl:when>
               <xsl:otherwise>
                 <field name="collection_membership.title_ms">
                   <xsl:value-of select="text()"/>
                 </field>
                 <field name="collection_membership.title_mt">
                   <xsl:value-of select="text()"/>
                 </field>
              </xsl:otherwise>
            </xsl:choose>
           </xsl:if>
          </xsl:for-each>
         </xsl:if>
        </xsl:for-each>

which also required these additions to the stylesheet declaration at the head of that file:

    xmlns:exts="xalan://dk.defxws.fedoragsearch.server.GenericOperationsImpl"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" exclude-result-prefixes="rdf java exts">


Essentially, this creates in solr a piece 'virtual metadata' which is the title of the collection.

This doesn't work if you have nested collections (though you could probably work some recursive variant of the above to handle that if absolutely required), which is OK for us since we have a business-level policy in place that we don't use nested collections.

   - Chris Warren
   Senior Academic Application Developer
   Williams College




--
For more information about using this group, please read our Listserv Guidelines: http://islandora.ca/content/welcome-islandora-listserv
---
You received this message because you are subscribed to the Google Groups "islandora" group.
To unsubscribe from this group and stop receiving emails from it, send an email to islandora+...@googlegroups.com.

Adam Vessey

unread,
Apr 18, 2016, 3:47:21 PM4/18/16
to isla...@googlegroups.com
Alternatively, I believe this may be much the same issue as describe in ISLANDORA-1661 (dealing with Fedora PID URIs), for which there is an open pull request.

Brandon Weigel

unread,
Apr 18, 2016, 5:04:35 PM4/18/16
to islandora
Thanks for the suggestions, all. If there are others that have done this with different approaches, I'd love to see them.

Would a built-in new Solr field for collection title be something we'd all like to see in core? 


And thanks, Adam, for pointing out the pull request - I'm happy to see the slash bug fix will be merged soon, so I'll only have to worry about the display pieces. 

Brandon Weigel

unread,
Jun 2, 2016, 2:49:30 PM6/2/16
to islandora
I don't know if this has been quietly worked on or if someone gave our server box a kick in the right place, but for Facets at least, using the object label suddenly seems to work. 

Still an issue in metadata display, though, where "use object label" isn't even an option.
Reply all
Reply to author
Forward
0 new messages