User Tools

Site Tools


en:user:gs3_sample_format_statements

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
en:user:gs3_sample_format_statements [2016/05/26 01:06] – [Sample Greenstone3 Format Statements] kjdonen:user:gs3_sample_format_statements [2016/09/26 22:42] – [Linking to search results] kjdon
Line 152: Line 152:
 } }
 </code> </code>
 +
 +
 +===== Linking metadata to a search =====
 +
 +How to link metadata values to a search for that value.
 +For example, say a document has several authors, stored as dc.Creator metadata. You can display a list of the authors, each one linked to a search of the dc.Creator index for that author.
 +
 +Collection setup:
 +  * dc.Creator metadata will need to be assigned to the documents
 +  * You need to add a search index on dc.Creator metadata
 +  * Build the collection
 +
 +You will need to find out the shortname for the dc.Creator index. You can look in web/sites/localsite/collect/<your-coll-name>/index/buildConfig.xml. Look for the section like:
 +<code>
 +<indexList>
 +  <index name="text" shortname="TX" />
 +  <index name="dc.Title,ex.dc.Title,Title" shortname="TI" />
 +  <index name="dc.Creator" shortname="CR" />
 +</indexList>
 +</code>
 +You can see from this example that the dc.Creator index got the shortname "CR". You will need this shortname to construct the search URL.
 +
 +
 +Next you need to modify your format statement to add in the search links. If you want these links to appear on the document page, select the "display" format item. (If you wanted them in search results, or on classifier pages, select the "search/browse/CLx" format items)
 +
 +The default XML for the display format item contains several commented out templates. Say you have simple documents (ie ones with no internal structure eg images), you can add the links to the "documentContent" template. If you have structured documents with secitons, then you want to ????
 +
 +The XML for the links looks something like the following:
 +
 +<code>
 +Search for Authors: <gsf:foreach-metadata name='dc.Creator'> 
 +   <a><xsl:attribute name="href"><xsl:value-of select="$_httpquery_"/>/TextQuery?qs=1&amp;rt=rd&amp;s1.level=Doc&amp;startPage=1&amp;s1.query=<gsf:meta-value/>&amp;s1.index=CR</xsl:attribute><gsf:meta-value/></a><xsl:text>, </xsl:text>
 +</gsf:foreach-metadata>
 +</code>
 +
  
  
en/user/gs3_sample_format_statements.txt · Last modified: 2023/03/13 01:46 by 127.0.0.1