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.config;
029
030import java.util.Map;
031
032/** Interface the common search configuration must implement. */
033public interface I_CmsSearchConfigurationCommon {
034
035    /** Returns a map from request parameter names to Solr query parts (where the parameter's values are typically inserted).
036     * @return A map from request parameter names to Solr query parts (where the parameter's values are typically inserted).
037     */
038    Map<String, String> getAdditionalParameters();
039
040    /** Returns a flag, indicating if special query characters (e.g., ":", "(", "[" ...) should be escaped in the query string.
041     * @return A flag, indicating if special query characters (e.g., ":", "(", "[" ...) should be escaped in the query string.
042     */
043    boolean getEscapeQueryChars();
044
045    /** Returns the extra params given to Solr.
046     * @return The extra params given to Solr - in format "p1=v1&p2=v2".
047     */
048    String getExtraSolrParams();
049
050    /**Flag, indicating if also resources that are expired.<p>
051     * NOTE: if you are not in the edit mode, the flag is ignored and expired resources are never returned.
052     *
053     * @return Flag, indicating if also resources that are expired should be returned.
054     */
055    boolean getIgnoreExpirationDate();
056
057    /** Returns a flag, indicating if the query and lastquery params should be ignored when
058     *  generating the query. This is useful, if you have a fixed query in the extra Solr params
059     *  configured.
060     * @return A flag, indicating if the query and lastquery params should be ignored.
061     */
062    boolean getIgnoreQueryParam();
063
064    /**Flag, indicating if also resources that are not yet released.<p>
065     * NOTE: if you are not in the edit mode, the flag is ignored and unreleased resources are never returned.
066     *
067     * @return Flag, indicating if also resources that are not yet released should be returned.
068     */
069    boolean getIgnoreReleaseDate();
070
071    /** Returns the parameter name of the request parameter used to send the last query string.
072     * @return The request parameter name used to send the last query string.
073     */
074    String getLastQueryParam();
075
076    /** Returns the number of maximally returned results.
077     *
078     * NOTE: If not explicitly specified, this value is read from the (index specific) system wide configuration.
079     *
080     * @return number of maximally returned results,.
081     */
082    int getMaxReturnedResults();
083
084    /** Modifies the query string according to the specified query modifier.
085     * @param queryString the query to modify.
086     * @return the modified query.
087     */
088
089    String getModifiedQuery(String queryString);
090
091    /** Returns the modifier for queries.
092     * @return the query modifier.
093     */
094    String getQueryModifier();
095
096    /** Returns the parameter name of the request parameter used to send the current query string.
097     * @return The request parameter name used to send the current query string.
098     */
099    String getQueryParam();
100
101    /** Returns the parameter name of the request parameter used to indicate if the search form is loaded the first time or repeatedly.
102     * @return The request parameter name used to indicate if the search form is loaded the first time or repeatedly.
103     */
104    String getReloadedParam();
105
106    /** Returns a flag, indicating if for an empty search query, search should be performed using a wildcard.
107     * @return A flag, indicating if for an empty search query, search should be performed using a wildcard.
108     */
109    boolean getSearchForEmptyQueryParam();
110
111    /** Returns the Solr core that should be used. Can also be <code>null</code>.
112     * @return The Solr core to use, or <code>null</code> if none is configured.
113     */
114    String getSolrCore();
115
116    /** Returns the Solr index that should be used.
117     * @return The Solr index to use.
118     */
119    String getSolrIndex();
120
121}