org.appng.taglib.search

## Class Search

- java.lang.Object
- - javax.servlet.jsp.tagext.TagSupport
  - - javax.servlet.jsp.tagext.BodyTagSupport
    - - org.appng.taglib.search.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 `SearchPart`s that use different `Application`s.

  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 and Description
    `Search()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addParameter(String name, String value)`
    `void` | `addPart(SearchPart p)`
    `String` | `cleanText(String description, Integer maxTextLength, String fillWith)`
    `int` | `doEndTag()`
    `String` | `getFormat()`
    `String` | `getHighlight()`
    `protected List<SearchPart>` | `getParts()`
    `boolean` | `isParts()`
    `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)`
    `void` | `setFormat(String format)`
    `void` | `setHighlight(String highlight)`
    `void` | `setParts(boolean useParts)`

    - ### Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport

      `doAfterBody, doInitBody, doStartTag, getBodyContent, getPreviousOut, release, setBodyContent`

    - ### Methods inherited from class javax.servlet.jsp.tagext.TagSupport

      `findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface javax.servlet.jsp.tagext.Tag

      `getParent, setPageContext, setParent`

- - ### 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`

    - #### cleanText

          public String cleanText(String description,
                                  Integer maxTextLength,
                                  String fillWith)

    - #### addPart

          public void addPart(SearchPart p)

    - #### 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)

    - #### addParameter

          public void addParameter(String name,
                                   String value)

      Specified by:
        `addParameter` in interface `ParameterOwner`

    - #### getParts

          protected List<SearchPart> getParts()

Copyright © 2011–2023 aiticon GmbH. All rights reserved.