/** * Sets the categories only if not set in the query parameters.<p> * * @param categories the categories to set */ public void setCategories(List<String> categories) { if ((categories != null) && !categories.isEmpty()) { addFilterQuery(CmsSearchField.FIELD_CATEGORY + CmsSearchField.FIELD_DYNAMIC_EXACT, categories, true, true); } }
/** * Sets the resource types only if not set in the query parameters.<p> * * @param resourceTypes the resourceTypes to set */ public void setResourceTypes(List<String> resourceTypes) { if ((resourceTypes != null) && !resourceTypes.isEmpty()) { addFilterQuery(CmsSearchField.FIELD_TYPE, resourceTypes, false, false); } }
/** * Sets the search roots only if not set as query parameter.<p> * * @param searchRoots the searchRoots to set */ public void setSearchRoots(List<String> searchRoots) { if ((searchRoots != null) && !searchRoots.isEmpty()) { addFilterQuery(CmsSearchField.FIELD_PARENT_FOLDERS, searchRoots, false, true); } }
/** * Removes the given filter queries, if already set and then adds the filter queries again.<p> * * @param fqs the filter queries to remove */ private void replaceFilterQueries(String[] fqs) { removeFilterQueries(fqs); addFilterQuery(fqs); } }
/** * Ensures that expired and not yet released resources are not returned by default.<p> */ private void ensureExpiration() { boolean expirationDateSet = false; boolean releaseDateSet = false; if (getFilterQueries() != null) { for (String fq : getFilterQueries()) { if (fq.startsWith(CmsSearchField.FIELD_DATE_EXPIRED + ":")) { expirationDateSet = true; } if (fq.startsWith(CmsSearchField.FIELD_DATE_RELEASED + ":")) { releaseDateSet = true; } } } if (!expirationDateSet) { addFilterQuery(CmsSearchField.FIELD_DATE_EXPIRED + ":[NOW TO *]"); } if (!releaseDateSet) { addFilterQuery(CmsSearchField.FIELD_DATE_RELEASED + ":[* TO NOW]"); } }
addFilterQuery(CmsSearchField.FIELD_CONTENT_LOCALES, localeStrings, false, false);
/** * Creates and adds a filter query.<p> * * @param fieldName the field name to create a filter query on * @param vals the values that should match for the given field * @param all <code>true</code> to combine the given values with 'AND', <code>false</code> for 'OR' * @param useQuotes <code>true</code> to surround the given values with double quotes, <code>false</code> otherwise */ public void addFilterQuery(String fieldName, List<String> vals, boolean all, boolean useQuotes) { if (getFilterQueries() != null) { for (String fq : getFilterQueries()) { if (fq.startsWith(fieldName + ":")) { removeFilterQuery(fq); } } } addFilterQuery(createFilterQuery(fieldName, vals, all, useQuotes)); }
query.addFilterQuery(CmsSearchField.FIELD_CONTAINER_TYPES, m_containerTypes, false, false); query.addFilterQuery( CmsSearchUtil.getDateCreatedTimeRangeFilterQuery( CmsSearchField.FIELD_DATE_CREATED, query.addFilterQuery( CmsSearchUtil.getDateCreatedTimeRangeFilterQuery( CmsSearchField.FIELD_DATE_LASTMODIFIED, addFoldersToSearchIn(m_galleries); setSearchFolders(cms); query.addFilterQuery( CmsSearchField.FIELD_PARENT_FOLDERS, new ArrayList<String>(m_foldersToSearchIn), query.addFilterQuery( "-" + CmsSearchField.FIELD_SEARCH_EXCLUDE, Arrays.asList(new String[] {"all", "gallery"}),
query.addFilterQuery(CmsSearchField.FIELD_SEARCH_EXCLUDE + ":\"false\"");