Package 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. ASearch
can contain multipleSearchPart
s that use differentApplication
s. Attributes (defaults in brackets):- format - one of
xml
orjson
- 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.
- 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
<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
-
-
Constructor Summary
Constructors Constructor Description Search()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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
-
-
-
-
Method Detail
-
doEndTag
public int doEndTag() throws javax.servlet.jsp.JspException
- Specified by:
doEndTag
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
doEndTag
in classjavax.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
-
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 interfaceParameterOwner
-
getParts
protected List<SearchPart> getParts()
-
-