/** * Set the comma separated search root names to restrict search to.<p> * * @param categories the comma separated category names to restrict search to */ public void setSearchCategories(String categories) { setCategories(CmsStringUtil.splitAsList(categories, ',')); }
/** * Set the comma separated search root names to restrict search to.<p> * * @param categories the comma separated category names to restrict search to */ public void setSearchCategories(String categories) { setCategories(CmsStringUtil.splitAsList(categories, ',')); }
/** * Sets the search categories, all search results must be in one of the categories, * the category set must match the indexed category exactly.<p> * * All categories will automatically be trimmed and lower cased, since search categories * are also stored this way in the index.<p> * * @param categories the categories to set */ public void setCategories(String[] categories) { List<String> setCategories = new ArrayList<String>(); if (categories != null) { if (categories.length != 0) { // ensure all categories are not null, trimmed, not-empty and lowercased String cat; for (int i = 0; i < categories.length; i++) { cat = categories[i]; if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(cat)) { // all categories must internally be lower case, // since the index keywords are lower cased as well cat = cat.trim().toLowerCase(); setCategories.add(cat); } } } } m_parameters.setCategories(setCategories); resetLastResult(); }
/** * Sets the search categories, all search results must be in one of the categories, * the category set must match the indexed category exactly.<p> * * All categories will automatically be trimmed and lower cased, since search categories * are also stored this way in the index.<p> * * @param categories the categories to set */ public void setCategories(String[] categories) { List<String> setCategories = new ArrayList<String>(); if (categories != null) { if (categories.length != 0) { // ensure all categories are not null, trimmed, not-empty and lowercased String cat; for (int i = 0; i < categories.length; i++) { cat = categories[i]; if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(cat)) { // all categories must internally be lower case, // since the index keywords are lower cased as well cat = cat.trim().toLowerCase(); setCategories.add(cat); } } } } m_parameters.setCategories(setCategories); resetLastResult(); }
m_searchParams.setCategories(CmsStringUtil.splitAsList(categories, ','));
/** * Overridden to additionally get a hold on the widget object of type * <code>{@link CmsSearchParameters}</code>.<p> * * @see org.opencms.workplace.tools.searchindex.A_CmsEditSearchIndexDialog#initUserObject() */ @SuppressWarnings("rawtypes") @Override protected void initUserObject() { super.initUserObject(); Object o = getDialogObject(); if (o == null) { m_searchParams = new CmsSearchParameters(); // implant a hook upon modifications of the list // this will set the search page to 1 if a restriction to the set of categories is performed m_searchParams.setCategories(new CmsHookListSearchCategory(m_searchParams, m_searchParams.getCategories())); m_search = new CmsSearch(); } else { Map dialogObject = (Map)o; m_searchParams = (CmsSearchParameters)dialogObject.get(PARAM_SEARCH_PARAMS); if (m_searchParams == null) { m_searchParams = new CmsSearchParameters(); } m_search = (CmsSearch)dialogObject.get(PARAM_SEARCH_OBJECT); if (m_search == null) { m_search = new CmsSearch(); } } m_searchParams.setSearchIndex(getSearchIndexIndex()); }