code: protected BooleanQuery.Builder appendCategoryFilter(
          CmsObject cms,
          BooleanQuery.Builder 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 BooleanClause(
                      getMultiTermQueryFilter(CmsSearchField.FIELD_CATEGORY, lowerCaseCategories),
                      BooleanClause.Occur.MUST));
          }
  
          return filter;
      }
docs: 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