/** * Returns a cached Lucene term query filter for the given field and terms.<p> * * @param field the field to use * @param terms the term to use * * @return a cached Lucene term query filter for the given field and terms */ protected Filter getMultiTermQueryFilter(String field, String terms) { return getMultiTermQueryFilter(field, terms, null); }
/** * Returns a cached Lucene term query filter for the given field and terms.<p> * * @param field the field to use * @param terms the term to use * * @return a cached Lucene term query filter for the given field and terms */ protected Filter getMultiTermQueryFilter(String field, String terms) { return getMultiTermQueryFilter(field, terms, null); }
/** * Returns a cached Lucene term query filter for the given field and terms.<p> * * @param field the field to use * @param terms the term to use * * @return a cached Lucene term query filter for the given field and terms */ protected Filter getMultiTermQueryFilter(String field, List<String> terms) { return getMultiTermQueryFilter(field, null, terms); }
/** * Returns a cached Lucene term query filter for the given field and terms.<p> * * @param field the field to use * @param terms the term to use * * @return a cached Lucene term query filter for the given field and terms */ protected Filter getMultiTermQueryFilter(String field, List<String> terms) { return getMultiTermQueryFilter(field, null, terms); }
/** * Returns a cached Lucene term query filter for the given field and term.<p> * * @param field the field to use * @param term the term to use * * @return a cached Lucene term query filter for the given field and term */ protected Filter getTermQueryFilter(String field, String term) { return getMultiTermQueryFilter(field, term, Collections.singletonList(term)); }
/** * Returns a cached Lucene term query filter for the given field and term.<p> * * @param field the field to use * @param term the term to use * * @return a cached Lucene term query filter for the given field and term */ protected Filter getTermQueryFilter(String field, String term) { return getMultiTermQueryFilter(field, term, Collections.singletonList(term)); }
/** * Appends the a category filter to the given filter clause that matches all given categories.<p> * * In case the provided List is null or empty, the original filter is left unchanged.<p> * * The original filter parameter is extended and also provided as return value.<p> * * @param cms the current OpenCms search context * @param filter the filter to extend * @param categories the categories that will compose the filter * * @return the extended filter clause */ protected BooleanFilter appendCategoryFilter(CmsObject cms, BooleanFilter filter, List<String> categories) { if ((categories != null) && (categories.size() > 0)) { // add query categories (if required) // categories are indexed as lower-case strings // @see org.opencms.search.fields.CmsSearchFieldConfiguration#appendCategories List<String> lowerCaseCategories = new ArrayList<String>(); for (String category : categories) { lowerCaseCategories.add(category.toLowerCase()); } filter.add( new FilterClause( getMultiTermQueryFilter(CmsSearchField.FIELD_CATEGORY, lowerCaseCategories), BooleanClause.Occur.MUST)); } return filter; }
/** * Appends the a resource type filter to the given filter clause that matches all given resource types.<p> * * In case the provided List is null or empty, the original filter is left unchanged.<p> * * The original filter parameter is extended and also provided as return value.<p> * * @param cms the current OpenCms search context * @param filter the filter to extend * @param resourceTypes the resource types that will compose the filter * * @return the extended filter clause */ protected BooleanFilter appendResourceTypeFilter(CmsObject cms, BooleanFilter filter, List<String> resourceTypes) { if ((resourceTypes != null) && (resourceTypes.size() > 0)) { // add query resource types (if required) filter.add( new FilterClause( getMultiTermQueryFilter(CmsSearchField.FIELD_TYPE, resourceTypes), BooleanClause.Occur.MUST)); } return filter; }
filter.add(new FilterClause(getMultiTermQueryFilter( CmsSearchField.FIELD_CATEGORY, params.getCategories()), BooleanClause.Occur.MUST)); filter.add(new FilterClause(getMultiTermQueryFilter( CmsSearchField.FIELD_TYPE, params.getResourceTypes()), BooleanClause.Occur.MUST));