Page History
...
For description of the query parameters, see above.
Add the confman namespace and "confman" to exclude-result-prefixes.
Code Block XML XML <xsl:stylesheet ... xmlns:confman="org.dspace.core.ConfigurationManager" exclude-result-prefixes="... confman">
Add this simple template to process the Solr query result. More complex date formatting can be done easily in XSLT 2.0 (see XSLT 2.0 spec), however Cocoon still uses XSLT 1.0 (see DS-995). It is currently also possible to call Java functions to do date formatting.
Code Block XML XML <xsl:template match="/response/result/doc/date" mode="lastItem"> Last item was imported: <xsl:value-of select="substring(text(), 1, 10)"/> </xsl:template>
Add the following code to the place where you want the resulting text to appear:
Code Block XML XML <xsl:variable name="solr-search-url" select="confman:getProperty('discovery', 'search.server')"/> <xsl:apply-templates select="document(concat($solr-search-url, '/select?q=search.resourcetype:2&sort=dc.date.accessioned_dt%20desc&rows=1&fl=dc.date.accessioned_dt&omitHeader=true'))" mode="lastItem"/>
For example, to add it after the list of Recent items in Mirage, override its template like this:
Code Block XML XML <xsl:template match="dri:referenceSet[@type = 'summaryList' and @n='site-last-submitted']" priority="2"> <xsl:apply-templates select="dri:head"/> <!-- Here we decide whether we have a hierarchical list or a flat one --> <xsl:choose> <xsl:when test="descendant-or-self::dri:referenceSet/@rend='hierarchy' or ancestor::dri:referenceSet/@rend='hierarchy'"> <ul> <xsl:apply-templates select="*[not(name()='head')]" mode="summaryList"/> </ul> </xsl:when> <xsl:otherwise> <ul class="ds-artifact-list"> <xsl:apply-templates select="*[not(name()='head')]" mode="summaryList"/> </ul> </xsl:otherwise> </xsl:choose> <xsl:variable name="solr-search-url" select="confman:getProperty('discovery', 'search.server')"/> <xsl:apply-templates select="document(concat($solr-search-url, '/select?q=search.resourcetype:2&sort=dc.date.accessioned_dt%20desc&rows=1&fl=dc.date.accessioned_dt&omitHeader=true'))" mode="lastItem"/> </xsl:template>
...
Warning | ||
---|---|---|
| ||
It's not officially recommended to change the |
Deleting Solr index data
...
title | Warning |
---|
...
If for whatever reason you need to delete the data in your index (which would normally be followed by running [dspace]/bin/dspace update-discovery-index
, but you can use the -b parameter instead to reindex everything), here's how you can do it:
...
It should also be possible to use it in other versions of DSpace (starting from 1.6-1.8), but these use different versions of Solr, so modify the procedure accordingly (and expect other caveats):
DSpace 4.0 | Solr 4.4.0 (expected) |
DSpace 3.0 | Solr 3.5.0 |
DSpace 1.8 | Solr 3.3.0 |
DSpace 1.7 | Solr 1.4.1 |
DSpace 1.6 | Solr 1.3.0 |
...