Zcms:text-search

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.


Contents

zcms:text-search

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="http://192.168.1.20:8080/solr/nutch/"/>

textsearch-result

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:textsearch-result>

zcms:search-attribute

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 />
  <head>
        <zcms:pagehead />
        <title> Title goes here </title>
  </head>
  <body>
  
     <form method="get" action="#">
      
      <input type="text" name="key" value=""/>
      <input type="submit" value="Search"/>
      
    </form> 
      <zcms:include widget="fsearch" type="fsearch"/>

  </body>
<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">
    <tr>
      <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>
    </tr>
  </zcms:textsearch-result>
</table>

<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:pageprevious>

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

</zcms:pagesequence>


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




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

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

See also

Personal tools
Namespaces

Variants
Actions
Toolbox