Class Search

  • All Implemented Interfaces:
    Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag, ParameterOwner

    public class Search
    extends javax.servlet.jsp.tagext.BodyTagSupport
    implements ParameterOwner
    This class represents a Search Tag used in JSP. A Search can contain multiple SearchParts that use different Applications.

    Attributes (defaults in brackets):

    • format - one of xml or json
    • parts (false) - whether the resulting XML/JSON should be split in parts
    • highlight (span) - the x(ht)ml-tag used to highlight the search term within the search results.

    Parameters: The following parameters (<appNG:param>) are supported (defaults in brackets):

    • pageSize (25)
      the page size to use
    • pageSizeParam (25)
      the name of the request parameter that contains the page-size
    • pageParam ("page")
      the name of the request parameter that contains the current page
    • queryParam ("q")
      the name of the request parameter that contains the search term
    • maxTextLength (150)
      the maximum length of a search result text
    • dateFormat ("yyyy-MM-dd")
      the date pattern used to format dates
    • fillWith (...)
      the placeholder used when the search result text is being stripped
    • xsl ()
      the path to the XSLT stylesheet to use when format is XML
    • pretty (false)
      if the XML/JSON output should be formatted prettily

    Usage:

     <appNG:search parts="false" format="json" highlight="span">
            <appNG:param name="queryParam">term</appNG:param>
            <appNG:searchPart application="global" language="de" title="Search Results" fields="title,contents" analyzerClass="org.apache.lucene.analysis.de.GermanAnalyzer"/>
     </appNG:search>
     
    Author:
    Matthias Müller
    See Also:
    SearchPart, Serialized Form
    • Field Summary

      • Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport

        bodyContent
      • Fields inherited from class javax.servlet.jsp.tagext.TagSupport

        id, pageContext
      • Fields inherited from interface javax.servlet.jsp.tagext.BodyTag

        EVAL_BODY_BUFFERED, EVAL_BODY_TAG
      • Fields inherited from interface javax.servlet.jsp.tagext.IterationTag

        EVAL_BODY_AGAIN
      • Fields inherited from interface javax.servlet.jsp.tagext.Tag

        EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
    • Constructor Summary

      Constructors 
      Constructor Description
      Search()  
    • Constructor Detail

      • Search

        public Search()
    • Method Detail

      • doEndTag

        public int doEndTag()
                     throws javax.servlet.jsp.JspException
        Specified by:
        doEndTag in interface javax.servlet.jsp.tagext.Tag
        Overrides:
        doEndTag in class javax.servlet.jsp.tagext.BodyTagSupport
        Throws:
        javax.servlet.jsp.JspException
      • processPart

        protected Part processPart​(Environment env,
                                   javax.servlet.http.HttpServletRequest servletRequest,
                                   Site site,
                                   SearchPart part,
                                   String term,
                                   org.apache.lucene.store.Directory directory,
                                   Integer maxTextLength,
                                   String fillWith)
                            throws javax.servlet.jsp.JspException
        Throws:
        javax.servlet.jsp.JspException
      • getFormat

        public String getFormat()
      • setFormat

        public void setFormat​(String format)
      • isParts

        public boolean isParts()
      • setParts

        public void setParts​(boolean useParts)
      • getHighlight

        public String getHighlight()
      • setHighlight

        public void setHighlight​(String highlight)