Class SearchTag

  • All Implemented Interfaces:
    javax.servlet.jsp.tagext.DynamicAttributes, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.SimpleTag

    public class SearchTag
    extends javax.servlet.jsp.tagext.SimpleTagSupport
    implements javax.servlet.jsp.tagext.DynamicAttributes
    Implements the wm:search tag. Performs a search query and returns the search results.

    Result is of type org.apache.solr.client.solrj.response.QueryResponse that has a results property that represents the results collection (each result of type SolrDocument).
    The SolrDocument owns the properties as defined in the used solr schema (work\searchengine\conf\core0\conf\schema.xml).

    See also:

    Example - search for some specific public content items in a language and print the link and title of the document:

     <!-- result:QueryResponse -->
     <wm:search var="result" query="q=webid:26098^0+AND+langid:43+AND+NOT+(loginrequired:true)"/>
     <!-- result.results:ArrayList<SolrDocument> extends ArrayList<SolrDocument> -->
     <c:forEach var="solrDocument" items="${result.results}">
       <!-- solrDocument:SolrDocument -->
       <a href="${solrDocument.location}">${solrDocument.title}</a><br />
    • Constructor Detail

      • SearchTag

        public SearchTag()
    • Method Detail

      • setQuery

        public void setQuery​(String query)
        Specifies the search query.
        query - The search query
      • setVar

        public void setVar​(String var)
        Specifies the JSP variable to store the result in.
        var - the name of the JSP variable to store the result in
      • setDynamicAttribute

        public void setDynamicAttribute​(String uri,
                                        String localName,
                                        Object value)
        Adds the dynamic attribute to this tag
        Specified by:
        setDynamicAttribute in interface javax.servlet.jsp.tagext.DynamicAttributes
        uri - the namespace of the attribute, or null if in the default namespace.
        localName - the name of the attribute being set.
        value - the value of the attribute
      • doTag

        public void doTag()
                   throws javax.servlet.jsp.JspException
        Specified by:
        doTag in interface javax.servlet.jsp.tagext.SimpleTag
        doTag in class javax.servlet.jsp.tagext.SimpleTagSupport