From GruppoZenit
Jump to: navigation, search

zcms:text-search ,textsearch-result and zcms:search-attribute tags are used to to perform full text search and display search results.



This tag is used to perform full text search on the website.the nutch and solr are used to crawl the web pages.the data for nutch and solr can be used to perform a full text search.

Attribute Definition
searchkey Defines the search parameter.
id Unique identifier of a full text search tag.
host Defines host name for nutch url.
serverconfig Defines the url of solr where the results can be retrieved.
datacount Defines the how many contents to be displayed.

Example: using zcms:text-search tag

 <zcms:text-search searchkey="key" datacount="20" id="searchid" host="www.gruppozenit.com"  serverconfig=""/>


This tag is a wrapper tag to wrap full text search result.

Attribute Definition
name Defines the id of the zcms:text-search for which the result is to be shown.

Example: using zcms:text-result tag

Example tag

<zcms:textsearch-result name="searchid">
    <zcms:search-attribute name="urlinfo"/>
    <zcms:search-attribute name="title"/>


zcms:search-attribute tag is used to select a particular attribute from search data. The zcms:search-attribute tag must be wrapped inside textsearch-result tag.

Attribute Definition
name Defines the name of the attribute.

NOTE: Use value "urlinfo" for attribute name to get the url corresponding to each web page in the search result. eg: <zcms:search-attribute name="urlinfo"/>

To use search-attribute values inside quotes use the following syntax eg:[zcms:search-attribute:attributename]

Example: using zcms:text-attribute tag

Example tag

 <zcms:search-attribute name="title"/>

Example: complete example showing how to use zcms:text-search, zcms:textsearch-result and zcms:search-attribute and pagination tags for full text search

The following lines is showing how to use zcms:text-search, zcms:textsearch-result and zcms:search-attribute tags.

Resource page

<zcms:pagestart />
        <zcms:pagehead />
        <title> Title goes here </title>
     <form method="get" action="#">
      <input type="text" name="key" value=""/>
      <input type="submit" value="Search"/>
      <zcms:include widget="fsearch" type="fsearch"/>

<zcms:pageend />

Widget: fsearch_fsearch

<zcms:text-search searchkey="key" datacount="20" id="searchid" host="www.gruppozenit.com"  serverconfig="http://localhost:8080/solr/nutch/" />

<table><tr><th>URL DATA</th><th>TITLE</th><th>CONTENT</th></tr>
  <zcms:textsearch-result name="searchid">
      <td><zcms:search-attribute name="urlinfo"/></td>
      <td><zcms:search-attribute name="title"/></td>
      <td>url is :<zcms:search-attribute name="url"/></td>
      <td><a href= "#[zcms:search-attribute:urlinfo]">url page</a></td>

<zcms:store var="param" value="$request[key]"/>

<zcms:pageprevious ref="searchid">
        <zcms:pagelink><a href="/searchform?key=[zcms:use:param]&selpage=[zcms:pagenumber]" shape="rect">previouspage</a></zcms:pagelink>

<zcms:pagesequence ref="searchid">
    <a href="/searchform?key=[zcms:use:param]&selpage=[zcms:pagenumber]"><zcms:pagenumber/></a>
     <a href="/searchform?key=[zcms:use:param]&selpage=[zcms:pagenumber]" style="background-color:red;"><zcms:pagenumber/></a>


<zcms:pagenext ref="searchid">
        <zcms:pagelink><a href="/searchform?key=[zcms:use:param]&selpage=[zcms:pagenumber]" shape="rect">nextpage</a></zcms:pagelink>

Total Number of pages <zcms:pagetotal ref="searchid"/>

Current Page Number  <zcms:pagecurrent ref="searchid"/>

See also

Personal tools