cancel
Showing results for 
Search instead for 
Did you mean: 

Add additional content properties in opensearch results ?

sanco
Champ in-the-making
Champ in-the-making
H All,
Is there a way to add additional content properties to be displayed in the search results? Currently only the description property of the document searched in displayed. Is it possible to add other content properties like modified date,author ets and display them?
Please give me some idea to make this change.
thanks in advance
4 REPLIES 4

kevinr
Star Contributor
Star Contributor
Assuming you want to change the OpenSearch results UI in the web-client then unfortunately that is generated on the client by JavaScript at the moment - so you would need to modify the file 'opensearch.js' - this is a known issue.

The standalone OpenSearch results (in ATOM, RSS or raw HTML formats) are output by a Freemarker template - so by changing this template you can easily add additional metadata or change the look and feel of the results.

See the files in somewhere similar to:
\tomcat\webapps\alfresco\WEB-INF\classes\alfresco\templates\webscripts\org\alfresco\repository\search

You will need this page if you want to modify the templates:
http://wiki.alfresco.com/wiki/Template_Guide

This page explains how to override the templates without modifying the ones in the classes dir:
http://wiki.alfresco.com/wiki/Web_Scripts#Where_do_Web_Scripts_Live.3F

Hope this helps,

Kevin

sanco
Champ in-the-making
Champ in-the-making
Hi Kevin,

Thanks..i was able to add additional properties in search result..

but i could not find the webscripts folder anywhere….im using alfresco-community-download-2.0.0
i modified the keyword-search-atom.ftl  file in tomcat/../classes/alfresco/templates folder..
i found the opensearch.js file in tomcat\webapps\alfresco\scripts\ajax folder..but i could not see the changes modified by me in this file…can i modify this file ?

Where are the search properties defined..because i want to display the size of the file…

this is the part in the ftl file i modified..

<#list search.results as row>
  <entry>
    <title>${row.name}</title>
    <link rel="alternate" href="${absurl(row.url)}"/>
    <icon>${absurl(row.icon16)}</icon>       <#comment>TODO: What's the standard for entry icons?</#comment>
    <id>urn:uuid:${row.id}</id>
    <updated>${xmldate(row.properties.modified)}</updated>
  
    <summary>${row.properties.description!""} modified : ${xmldate(row.properties.modified)!""} Author : ${row.properties.author!""} User : ${row.properties.creator!""} </summary>   
    <author>
      <name>${row.properties.creator}</name>
    </author>
    <relevance:score>${row.score}</relevance:score>
  </entry>
</#list>


summary tag value is fetched in opensearch.js..
i tried to add these properties by seeing the content properties name in alfresco .. which were like creator,author,size,createddate,modifieddate
but if i do the same with ${row.properties.size!""}..im not able to fetch the data…

where can i find these properties defined?

Thanks for the help

please help me out to customize this ftl…give me some more source for me to read and implement

thanks in advance,

sanco
Champ in-the-making
Champ in-the-making
I was able to find the search parameters about the document from other document ftl fiels in templates folder.

I want to know what algorithm is used to calculate the relevance score in opensearch?

<relevance:score>${row.score}</relevance:score>
what does this value represents in terms of the relevance of document with the search terms?

what is the relevance algorithm used to determine this score and what is its significance?

I would appreciate any kind of help offered in this direction.

thanks in advance,

kevinr
Star Contributor
Star Contributor
The 'score' value is provided by Lucene - the full-text search engine we use under the covers. We use the default Lucene scorer implementation. There are a lot of docs on lucene to be found on the net.

Thanks,

Kevin