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 last index of the documents displayed.
061     * @return The last index of the documents displayed.
062     */
063    int getEnd();
064
065    /** Returns the search exception if search fails.
066     * @return The exception thrown by Solr, or <code>null</code> if the search succeeds. */
067    CmsSearchException getException();
068
069    /** Returns the result of the query facet, i.e., the map from queries to the number of hits.
070     * @return The result of the query facet, i.e., the map from queries to the number of hits.
071     */
072    Map<String, Integer> getFacetQuery();
073
074    /** Returns the map for field facet names to the search result part for that field facet.
075     * @return The map for field facet names to the search result part for that field facet.
076     */
077    Map<String, FacetField> getFieldFacet();
078
079    /** Returns the collection of the search result parts for the field facets.
080     * @return The collection of the search result parts for the field facets.
081     */
082    Collection<FacetField> getFieldFacets();
083
084    /** Returns the query object as send to Solr.
085     * @return The query object as send to Solr.
086     */
087    CmsSolrQuery getFinalQuery();
088
089    /** Returns the map from the document ids to the corresponding highlighting results (as map from the highlighted field to the highlighted snippets).
090     * @return The map from the document ids to the corresponding highlighting results (as map from the highlighted field to the highlighted snippets).
091     */
092    Map<String, Map<String, List<String>>> getHighlighting();
093
094    /** Returns the maximal score of the found documents.
095     * @return The maximal score of the found documents.
096     */
097    Float getMaxScore();
098
099    /** Returns for the specified facet (key) the selected facet entries that are not part of the returned facet entries are provided (value).
100     * @return For the specified facet (key) the selected facet entries that are not part of the returned facet entries are provided (value).
101     */
102    Map<String, List<String>> getMissingSelectedFieldFacetEntries();
103
104    /** Returns the selected facet entries that are not part of the returned facet entries are provided (value).
105     * @return The selected facet entries that are not part of the returned facet entries are provided (value).
106     */
107    List<String> getMissingSelectedQueryFacetEntries();
108
109    /** Returns for the specified facet (key) the selected facet entries that are not part of the returned facet entries are provided (value).
110     * @return For the specified facet (key) the selected facet entries that are not part of the returned facet entries are provided (value).
111     */
112    Map<String, List<String>> getMissingSelectedRangeFacetEntries();
113
114    /** Returns the number of resources that where found.
115     * @return The number of resources that where found.
116     */
117    long getNumFound();
118
119    /** Returns the number of pages necessary to show all search results.
120     * @return The number of pages necessary to show all search results.
121     */
122    int getNumPages();
123
124    /** Returns the number of the fist page that should be shown in a "Google"-like page navigation.
125     * @return The number of the fist page that should be shown in a "Google"-like page navigation.
126     */
127    int getPageNavFirst();
128
129    /** Returns the number of the last page that should be shown in a "Google"-like page navigation.
130     * @return The number of the last page that should be shown in a "Google"-like page navigation.
131     */
132    int getPageNavLast();
133
134    /** Returns the map for range facet names to the search result part for that range facet.
135     * @return The map for range facet names to the search result part for that range facet.
136     */
137    @SuppressWarnings("rawtypes")
138    Map<String, RangeFacet> getRangeFacet();
139
140    /** Returns the collection of the search result parts for the range facets.
141     * @return The collection of the search result parts for the range facets.
142     */
143    @SuppressWarnings("rawtypes")
144    Collection<RangeFacet> getRangeFacets();
145
146    /** Returns the collection of the search results that are returned by Solr.
147     * @return The collection of the search results that are returned by Solr.
148     */
149    Collection<I_CmsSearchResourceBean> getSearchResults();
150
151    /** Returns the index (starting at 1) of the first result that is returned for displaying.
152     * @return The index (starting at 1) of the first result that is returned for displaying.
153     */
154    Long getStart();
155
156    /** Returns the map from a sort option name to the link parameters that should be appended when you want to display that search option.
157     * @return The map from a sort option name to the link parameters that should be appended when you want to display that search option.
158     */
159    I_CmsSearchStateParameters getStateParameters();
160}