public abstract class BaseSearchServiceConnector
extends org.exoplatform.commons.api.search.SearchServiceConnector
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_SITENAME |
protected DocumentService |
documentService |
protected ManageDriveService |
driveService_ |
static String |
NONE_NAGVIGATION |
static String |
PAGE_NAGVIGATION |
static String |
PORTLET_NAME |
protected SiteSearchService |
siteSearch_ |
static String |
sortByDate |
static String |
sortByRelevancy |
static String |
sortByTitle |
| Constructor and Description |
|---|
BaseSearchServiceConnector(org.exoplatform.container.xml.InitParams initParams) |
| Modifier and Type | Method and Description |
|---|---|
protected List<org.exoplatform.commons.api.search.data.SearchResult> |
convertResult(AbstractPageList<ResultNode> pageList,
int limit,
int offset,
org.exoplatform.commons.api.search.data.SearchContext context)
converts data: from
PageList<ResultNode> to List<SearchResult> |
protected abstract QueryCriteria |
createQueryCriteria(String query,
long offset,
long limit,
String sort,
String order)
creates the QueryCriteria object based on the search service
|
protected String |
fileSize(javax.jcr.Node node)
gets the file size
|
protected abstract ResultNode |
filterNode(ResultNode node)
filters the node base on search type: document or file
|
protected String |
formatDate(Calendar date)
formats the date object in simple date format
|
protected Calendar |
getDate(javax.jcr.Node node)
returns the date information of node
|
protected abstract String |
getDetails(ResultNode node,
org.exoplatform.commons.api.search.data.SearchContext context)
gets the detail about result node
|
protected String |
getDriveTitle(DriveData driveData) |
protected abstract String |
getFileType(ResultNode node)
gets the file type
|
protected abstract String |
getImageUrl(javax.jcr.Node node)
gets the image url
|
protected abstract String |
getPath(ResultNode node,
org.exoplatform.commons.api.search.data.SearchContext context)
returns path of node in format: "{drivename}/{relative path from drive root node}
|
protected String |
getPreviewUrl(ResultNode node,
org.exoplatform.commons.api.search.data.SearchContext context)
returns the preview url
|
protected abstract String |
getTitleResult(ResultNode node)
gets the title of result, based on the result type
|
protected static String |
removeAccents(String query)
Remove accents from query
|
Collection<org.exoplatform.commons.api.search.data.SearchResult> |
search(org.exoplatform.commons.api.search.data.SearchContext context,
String query,
Collection<String> sites,
int offset,
int limit,
String sort,
String order)
The connectors must implement this search method, with the following parameters and return a collection of SearchResult
|
protected abstract AbstractPageList<ResultNode> |
searchNodes(QueryCriteria criteria,
org.exoplatform.commons.api.search.data.SearchContext context)
searches base on the search service type
|
getDisplayName, getSearchType, isEnable, setDisplayName, setEnable, setSearchTypepublic static final String sortByDate
public static final String sortByRelevancy
public static final String sortByTitle
protected SiteSearchService siteSearch_
protected DocumentService documentService
protected ManageDriveService driveService_
public static final String DEFAULT_SITENAME
public static final String PAGE_NAGVIGATION
public static final String NONE_NAGVIGATION
public static final String PORTLET_NAME
public Collection<org.exoplatform.commons.api.search.data.SearchResult> search(org.exoplatform.commons.api.search.data.SearchContext context, String query, Collection<String> sites, int offset, int limit, String sort, String order)
search in class org.exoplatform.commons.api.search.SearchServiceConnectorcontext - Search contextquery - The user-input query to search forsites - Search on these specified sites only (e.g acme, intranet...)offset - Start offset of the result setlimit - Maximum size of the result setsort - The field to sort the result setorder - Sort order (ASC, DESC)protected abstract QueryCriteria createQueryCriteria(String query, long offset, long limit, String sort, String order)
query - the query stringoffset - the offsetlimit - the limitsort - sort fieldorder - order byprotected abstract AbstractPageList<ResultNode> searchNodes(QueryCriteria criteria, org.exoplatform.commons.api.search.data.SearchContext context) throws Exception
criteria - the query criteriaExceptionprotected abstract ResultNode filterNode(ResultNode node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionprotected List<org.exoplatform.commons.api.search.data.SearchResult> convertResult(AbstractPageList<ResultNode> pageList, int limit, int offset, org.exoplatform.commons.api.search.data.SearchContext context)
PageList<ResultNode> to List<SearchResult>pageList - protected String fileSize(javax.jcr.Node node) throws Exception
node - The nodeExceptionprotected Calendar getDate(javax.jcr.Node node) throws Exception
node - the nodeExceptionprotected String formatDate(Calendar date)
date - the Date objectprotected static String removeAccents(String query)
query - protected abstract String getPath(ResultNode node, org.exoplatform.commons.api.search.data.SearchContext context) throws Exception
node - the nodeExceptionprotected String getPreviewUrl(ResultNode node, org.exoplatform.commons.api.search.data.SearchContext context) throws Exception
node - the nodeExceptionprotected abstract String getFileType(ResultNode node) throws Exception
Exceptionprotected abstract String getTitleResult(ResultNode node) throws Exception
node - Exceptionprotected abstract String getImageUrl(javax.jcr.Node node)
protected abstract String getDetails(ResultNode node, org.exoplatform.commons.api.search.data.SearchContext context) throws Exception
node - the nodeExceptionCopyright © 2003–2019 eXo Platform SAS. All rights reserved.