001/* 002 * Copyright 2017 Anyware Services 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.ametys.web.frontoffice; 017 018import java.util.Collection; 019import java.util.List; 020import java.util.Set; 021 022import org.apache.cocoon.environment.Request; 023 024import org.ametys.cms.search.query.Query; 025import org.ametys.runtime.plugin.component.Prioritizable; 026import org.ametys.web.frontoffice.FrontOfficeSearcherFactory.QueryFacet; 027 028/** 029 * Modify the FO search query. 030 */ 031public interface QueryAdapterFOSearch extends Prioritizable 032{ 033 /** Minimum priority. */ 034 public static final int MIN_PRIORITY = Integer.MAX_VALUE; 035 /** Maximum priority. */ 036 public static final int MAX_PRIORITY = 0; 037 038 /** 039 * Modify the FO search query. 040 * @param query the initial query 041 * @param request The request 042 * @param siteNames The site names. 043 * @param language The language 044 * @return the new modify query 045 */ 046 Query modifyQuery(Query query, Request request, Collection<String> siteNames, String language); 047 048 /** 049 * Modify the site query. 050 * @param siteQuery the initial site query 051 * @param request The request 052 * @param siteNames The site names. 053 * @param language The language 054 * @return the new modify site query 055 */ 056 Query modifySiteQueryFilter(Query siteQuery, Request request, Collection<String> siteNames, String language); 057 058 /** 059 * Modify the sitemap query. 060 * @param sitemapQuery the initial sitemap query 061 * @param request The request 062 * @param siteNames The site names. 063 * @param language The language 064 * @return the new modify site query 065 */ 066 Query modifySitemapQueryFilter(Query sitemapQuery, Request request, Collection<String> siteNames, String language); 067 068 /** 069 * Modify the query facets 070 * @param queryFacets the initial query facets 071 * @param request the request 072 * @return the new query facets 073 */ 074 Set<QueryFacet> modifyQueryFacets(Set<QueryFacet> queryFacets, Request request); 075 076 /** 077 * Add document type 078 * @param documentTypes the document types 079 */ 080 void addDocumentType(List<String> documentTypes); 081}