/** * Restrict the result of the next search to the results of the last search, * restricted with the provided parameters.<p> * * Use this for "seach in search result" functions.<p> * * @param restriction the restriction to use * * @see CmsSearchParameters#restrict(CmsSearchParameters) */ public void setResultRestriction(CmsSearchParameters restriction) { resetLastResult(); m_parameterRestriction = restriction; }
/** * Restrict the result of the next search to the results of the last search, * restricted with the provided parameters.<p> * * Use this for "seach in search result" functions.<p> * * @param restriction the restriction to use * * @see CmsSearchParameters#restrict(CmsSearchParameters) */ public void setResultRestriction(CmsSearchParameters restriction) { resetLastResult(); m_parameterRestriction = restriction; }
/** * Sets the current result page.<p> * * Works with jsp bean mechanism for request parameter "searchPage" * that is generated here for page links.<p> * * @param page the current result page */ public void setSearchPage(int page) { m_parameters.setSearchPage(page); resetLastResult(); }
/** * Sets the sort order used for sorting the results of s search.<p> * * @param sortOrder the sort order to set */ public void setSortOrder(Sort sortOrder) { m_parameters.setSort(sortOrder); resetLastResult(); }
/** * Sets the number of matches per page.<p> * * @param matches the number of matches per page */ public void setMatchesPerPage(int matches) { m_parameters.setMatchesPerPage(matches); resetLastResult(); }
/** * Sets the sort order used for sorting the results of s search.<p> * * @param sortOrder the sort order to set */ public void setSortOrder(Sort sortOrder) { m_parameters.setSort(sortOrder); resetLastResult(); }
/** * Limits the search to a given list of resource types only.<p> * * @param resourceTypes the resource types to limit the search result to */ public void setResourceTypes(String[] resourceTypes) { if (resourceTypes != null) { m_parameters.setResourceTypes(Arrays.asList(resourceTypes)); } resetLastResult(); }
/** * Sets the current result page.<p> * * Works with jsp bean mechanism for request parameter "searchPage" * that is generated here for page links.<p> * * @param page the current result page */ public void setSearchPage(int page) { m_parameters.setSearchPage(page); resetLastResult(); }
/** * Sets the number of matches per page.<p> * * @param matches the number of matches per page */ public void setMatchesPerPage(int matches) { m_parameters.setMatchesPerPage(matches); resetLastResult(); }
/** * Sets the fields to search.<p> * * If the fields are set to <code>null</code>, * or not set at all, the default fields "content" and "meta" are used.<p> * * For a list of valid field names, see the Interface constants of * <code>{@link org.opencms.search.documents.I_CmsDocumentFactory}</code>. * * @param fields the fields to search */ public void setField(String[] fields) { m_parameters.setFields(Arrays.asList(fields)); resetLastResult(); }
/** * Sets the fields to search.<p> * * If the fields are set to <code>null</code>, * or not set at all, the default fields "content" and "meta" are used.<p> * * For a list of valid field names, see the Interface constants of * <code>{@link org.opencms.search.documents.I_CmsDocumentFactory}</code>. * * @param fields the fields to search */ public void setField(String[] fields) { m_parameters.setFields(Arrays.asList(fields)); resetLastResult(); }
/** * Controls if the excerpt from a field is generated only for searched fields, or for all fields (the default).<p> * * The default setting is <code>false</code>, which means all text fields configured for the excerpt will * be used to generate the excerpt, regardless if they have been searched in or not.<p> * * Please note: A field will only be included in the excerpt if it has been configured as <code>excerpt="true"</code> * in <code>opencms-search.xml</code>. This method controls if so configured fields are used depending on the * fields searched, see {@link #setField(String[])}.<p> * * @param value if <code>true</code>, the excerpt is generated only from the fields actually searched in */ public void setExcerptOnlySearchedFields(boolean value) { m_parameters.setExcerptOnlySearchedFields(value); resetLastResult(); }
/** * Controls if the excerpt from a field is generated only for searched fields, or for all fields (the default).<p> * * The default setting is <code>false</code>, which means all text fields configured for the excerpt will * be used to gernerate the excerpt, regardless if they have been searched in or not.<p> * * Please note: A field will only be included in the excerpt if it has been configured as <code>excerpt="true"</code> * in <code>opencms-search.xml</code>. This method controls if so configured fields are used depending on the * fields searched, see {@link #setField(String[])}.<p> * * @param value if <code>true</code>, the excerpt is generated only from the fields actually searched in */ public void setExcerptOnlySearchedFields(boolean value) { m_parameters.setExcerptOnlySearchedFields(value); resetLastResult(); }
/** * Sets the search root list.<p> * * Only resources that are sub-resources of one of the search roots * are included in the search result.<p> * * The search roots set here are used <i>in addition to</i> the current site root * of the user performing the search.<p> * * By default, the search roots contain only one entry with an empty string.<p> * * @param searchRoots the search roots to set */ public void setSearchRoots(String[] searchRoots) { List<String> l = new ArrayList<String>(Arrays.asList(searchRoots)); m_parameters.setRoots(l); resetLastResult(); }
/** * Sets the search root list.<p> * * Only resources that are sub-resources of one of the search roots * are included in the search result.<p> * * The search roots set here are used <i>in addition to</i> the current site root * of the user performing the search.<p> * * By default, the search roots contain only one entry with an empty string.<p> * * @param searchRoots the search roots to set */ public void setSearchRoots(String[] searchRoots) { List<String> l = new ArrayList<String>(Arrays.asList(searchRoots)); m_parameters.setRoots(l); resetLastResult(); }
/** * Adds an individual query for a search field.<p> * * If this is used, any setting made with {@link #setQuery(String)} and {@link #setField(String[])} * will be ignored and only the individual field search settings will be used.<p> * * When combining occurrences of SHOULD, MUST and MUST_NOT, keep the following in mind: * All SHOULD clauses will be grouped and wrapped in one query, * all MUST and MUST_NOT clauses will be grouped in another query. * This means that at least one of the terms which are given as a SHOULD query must occur in the * search result.<p> * * @param fieldName the field name * @param searchQuery the search query * @param occur the occur parameter for the query in the field * * @since 7.5.1 */ public void addFieldQuery(String fieldName, String searchQuery, Occur occur) { m_parameters.addFieldQuery(fieldName, searchQuery, occur); resetLastResult(); }
/** * Adds an individual query for a search field.<p> * * If this is used, any setting made with {@link #setQuery(String)} and {@link #setField(String[])} * will be ignored and only the individual field search settings will be used.<p> * * When combining occurrences of SHOULD, MUST and MUST_NOT, keep the following in mind: * All SHOULD clauses will be grouped and wrapped in one query, * all MUST and MUST_NOT clauses will be grouped in another query. * This means that at least one of the terms which are given as a SHOULD query must occur in the * search result.<p> * * @param fieldQuery the field query to use * * @since 8.0.2 */ public void addFieldQuery(CmsSearchFieldQuery fieldQuery) { m_parameters.addFieldQuery(fieldQuery); resetLastResult(); }
/** * Limits the search to a given list of resource types only.<p> * * @param resourceTypes the resource types to limit the search result to */ public void setResourceTypes(String[] resourceTypes) { if (resourceTypes != null) { m_parameters.setResourceTypes(Arrays.asList(resourceTypes)); } else { m_parameters.setResourceTypes(null); } resetLastResult(); }
/** * Sets the search query.<p> * * The syntax of the query depends on the search engine used. * A former search result will be deleted.<p> * * @param query the search query (escaped format) */ public void setQuery(String query) { try { m_parameters.setQuery(CmsEncoder.decodeParameter(query)); } catch (CmsIllegalArgumentException iae) { m_lastException = iae; } resetLastResult(); }
/** * Sets the search query.<p> * * The syntax of the query depends on the search engine used. * A former search result will be deleted.<p> * * @param query the search query (escaped format) */ public void setQuery(String query) { try { m_parameters.setQuery(CmsEncoder.decodeParameter(query)); } catch (CmsIllegalArgumentException iae) { m_lastException = iae; } resetLastResult(); }