001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.jsp.search.result; 029 030import org.opencms.jsp.search.controller.I_CmsSearchControllerMain; 031import org.opencms.search.CmsSearchException; 032import org.opencms.search.solr.CmsSolrQuery; 033 034import java.util.Collection; 035import java.util.List; 036import java.util.Map; 037 038import org.apache.solr.client.solrj.response.FacetField; 039import org.apache.solr.client.solrj.response.RangeFacet; 040import org.apache.solr.client.solrj.response.SpellCheckResponse.Suggestion; 041 042/** Interface of the JSP EL friendly wrapper for all Solr search results and the search form controller. */ 043public interface I_CmsSearchResultWrapper { 044 045 /** Returns the main controller for the search form. 046 * @return The main controller for the search form. 047 */ 048 I_CmsSearchControllerMain getController(); 049 050 /** Returns the "Did you mean ...?" suggestion - if did you mean is enabled. 051 * @return The "Did you mean ...?" suggestion - if did you mean is enabled. 052 */ 053 String getDidYouMeanCollated(); 054 055 /** Returns the suggestion of "Did you mean ...?" for the complete query - if did you mean is enabled. 056 * @return The suggestion of "Did you mean ...?" for the complete query - if did you mean is enabled. 057 */ 058 Suggestion getDidYouMeanSuggestion(); 059 060 /** Returns the empty search state parameters. Use the function to generate just part of the state parameters, instead of manipulating the current state. 061 * @return The empty search state parameters. 062 */ 063 I_CmsSearchStateParameters getEmptyStateParameters(); 064 065 /** Returns the last index of the documents displayed. 066 * @return The last index of the documents displayed. 067 */ 068 int getEnd(); 069 070 /** Returns the search exception if search fails. 071 * @return The exception thrown by Solr, or <code>null</code> if the search succeeds. */ 072 CmsSearchException getException(); 073 074 /** Returns the result of the query facet, i.e., the map from queries to the number of hits. 075 * @return The result of the query facet, i.e., the map from queries to the number of hits. 076 */ 077 Map<String, Integer> getFacetQuery(); 078 079 /** Returns the map for field facet names to the search result part for that field facet. 080 * @return The map for field facet names to the search result part for that field facet. 081 */ 082 Map<String, FacetField> getFieldFacet(); 083 084 /** Returns the collection of the search result parts for the field facets. 085 * @return The collection of the search result parts for the field facets. 086 */ 087 Collection<FacetField> getFieldFacets(); 088 089 /** Returns the query object as send to Solr. 090 * @return The query object as send to Solr. 091 */ 092 CmsSolrQuery getFinalQuery(); 093 094 /** Returns the map from the document ids to the corresponding highlighting results (as map from the highlighted field to the highlighted snippets). 095 * @return The map from the document ids to the corresponding highlighting results (as map from the highlighted field to the highlighted snippets). 096 */ 097 Map<String, Map<String, List<String>>> getHighlighting(); 098 099 /** Returns the maximal score of the found documents. 100 * @return The maximal score of the found documents. 101 */ 102 Float getMaxScore(); 103 104 /** Returns for the specified facet (key) the selected facet entries that are not part of the returned facet entries are provided (value). 105 * @return For the specified facet (key) the selected facet entries that are not part of the returned facet entries are provided (value). 106 */ 107 Map<String, List<String>> getMissingSelectedFieldFacetEntries(); 108 109 /** Returns the selected facet entries that are not part of the returned facet entries are provided (value). 110 * @return The selected facet entries that are not part of the returned facet entries are provided (value). 111 */ 112 List<String> getMissingSelectedQueryFacetEntries(); 113 114 /** Returns for the specified facet (key) the selected facet entries that are not part of the returned facet entries are provided (value). 115 * @return For the specified facet (key) the selected facet entries that are not part of the returned facet entries are provided (value). 116 */ 117 Map<String, List<String>> getMissingSelectedRangeFacetEntries(); 118 119 /** Returns the number of resources that where found. 120 * @return The number of resources that where found. 121 */ 122 long getNumFound(); 123 124 /** Returns the number of pages necessary to show all search results. 125 * @return The number of pages necessary to show all search results. 126 */ 127 int getNumPages(); 128 129 /** Returns the number of the fist page that should be shown in a "Google"-like page navigation. 130 * @return The number of the fist page that should be shown in a "Google"-like page navigation. 131 */ 132 int getPageNavFirst(); 133 134 /** Returns the number of the last page that should be shown in a "Google"-like page navigation. 135 * @return The number of the last page that should be shown in a "Google"-like page navigation. 136 */ 137 int getPageNavLast(); 138 139 /** Returns the map for range facet names to the search result part for that range facet. 140 * @return The map for range facet names to the search result part for that range facet. 141 */ 142 @SuppressWarnings("rawtypes") 143 Map<String, RangeFacet> getRangeFacet(); 144 145 /** Returns the collection of the search result parts for the range facets. 146 * @return The collection of the search result parts for the range facets. 147 */ 148 @SuppressWarnings("rawtypes") 149 Collection<RangeFacet> getRangeFacets(); 150 151 /** Returns the collection of the search results that are returned by Solr. 152 * @return The collection of the search results that are returned by Solr. 153 */ 154 Collection<I_CmsSearchResourceBean> getSearchResults(); 155 156 /** Returns the index (starting at 1) of the first result that is returned for displaying. 157 * @return The index (starting at 1) of the first result that is returned for displaying. 158 */ 159 Long getStart(); 160 161 /** Returns the current search state parameters. 162 * @return The current search state parameters. 163 */ 164 I_CmsSearchStateParameters getStateParameters(); 165}