Showing Search Results
Search results are returned in a
neo.xredsys.content.search.SearchResult
object,
which implements java.util.List
. This makes it
quite easy to iterate through the results and extract information
about each hit, as shown below:
Iterator i = result.iterator(); while(i.hasNext()) { neo.xredsys.content.search.SearchHit hit = (neo.xredsys.content.search.SearchHit)i.next(); System.out.println("ArticleID:" + hit.getObjectId() + " Title " + hit.getField("title")); }
First an iterator is created, and then used to access each
neo.xredsys.content.search.SearchHit
in the result
set; articleID
and title
properties are then retrieved from each SearchHit
object and displayed. For a full list of all
neo.xredsys.content.search.SearchHit
properties,
see SearchHit Properties.
The correct way to construct links from search results is as follows for an Escenic site:
http://www.site/current-pub/eceRedirect?articleId=articleIdD&pubId=pubId
where:
site is the name of the site.
current-pub is the name of the current publication.
articleID is the
articleID
property of the
SearchHit
object.
pubID is the pubID
property of the SearchHit
object.
For a portal site, however, you should construct it as follows:
http://www.portal/current-pub/Ece2PortalUrl?articleId=articleIdD
where:
portal is the name of the portal.
current-pub is the name of the current publication.
articleID is the
articleID
property of the
SearchHit
object.
When creating a link to the actual article, the HTTP link should point to http://www.site.com/[pub]/eceRedirect?articleId=[articleId]&pubId?[pubId] for Escenic sites, or http://www.site.no/[pub]/Ece2PortalUrl?articleId=[articleId] for Portal sites. This is also for avoiding the use of the Escenic API during iteration of the search results.
For further information about the
SearchResult
object, see the Escenic
Content Engine Bean Reference.