Delivery Framework | Version 3

Solr-Taglib

Solr-Taglib

Archived documentation for Sophora 3. End-of-support date for this version: 7/25/21

Documentation for Sophora 4

Configuration

Maven dependancy

<dependency>
    <groupId>com.subshell.sophora</groupId>
    <artifactId>com.subshell.sophora.delivery.solr</artifactId>
    <version>VERSION</version>
</dependency>

Connection to the Solr-Server

To configure the connection to a Solr-Server, you can set the property sophora.delivery.solr.url, the default value for this property is http://localhost:1196/solr.

sophora.delivery.solr.url=http://localhost:1196/solr

Setting the username and password for solr server you should use this properties:

# Default: solr
sophora.delivery.solr.user=
 
# Default: solr
sophora.delivery.solr.password=

Template development

A little code snippet, to show the usage of the Solr-Taglib:

<%@ page pageEncoding="utf-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://www.subshell.com/sophora/solr/jsp" prefix="sophora-solr" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
 
<sophora-solr:search var="result" pageNumber="0" pageSize="1" corename="MY_CORENAME" query="*:*" />
 
NEXT: ${result.hasNext}<br />
PREVIOUS: ${result.hasPrevious}<br />
NUM: ${result.numFound}<br />
START: ${result.start}<br />
SIZE: ${result.size}<br />
PAGESIZE: ${result.pageSize}<br />
PAGENUMBER: ${result.pageNumber}<br />
 
<hr />
<c:forEach var="entry" items="${result.entries}">
    ${entry.id}<hr />
</c:forEach>

Last modified on 7/30/19

The content of this page is licensed under the CC BY 4.0 License. Code samples are licensed under the MIT License.

Icon