001/* 002 * Copyright 2018 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.search.requesttime; 017 018import org.ametys.cms.search.solr.SearcherFactory.Searcher; 019import org.ametys.runtime.plugin.component.PluginAware; 020import org.ametys.runtime.plugin.component.Prioritizable; 021import org.ametys.runtime.plugin.component.Supporter; 022 023/** 024 * A component which will execute a part of a FO search through {@link SearchServiceGenerator}. 025 */ 026public interface SearchComponent extends Prioritizable, Supporter<SearchComponentArguments>, PluginAware 027{ 028 /** Minimum priority */ 029 public static final int MIN_PRIORITY = Integer.MAX_VALUE; 030 /** 031 * Priority of the component executing the {@link Searcher#searchWithFacets() search} and {@link SearchComponentArguments#setResults(org.ametys.cms.search.SearchResults) setting the results}. 032 * <br>Thus, this constant can be used to define {@link #getPriority()} method whether the component must execute before or after the search. 033 */ 034 public static final int SEARCH_PRIORITY = 0; 035 /** Maximum priority */ 036 public static final int MAX_PRIORITY = Integer.MIN_VALUE; 037 038 /** A {@link SearchComponentArguments#generatorParameters() generator parameter name} for disabling default sax and use a custom search component instead */ 039 public static final String DISABLE_DEFAULT_SAX_PARAMETER_NAME = "disableDefaultSax"; 040 041 /** 042 * Executes the component. 043 * @param args the arguments 044 * @throws Exception if an exception occurs. Other search components will be attempted to be executed 045 */ 046 void execute(SearchComponentArguments args) throws Exception; 047 048 /** 049 * Get the identifier of the search component 050 * @return the identifier 051 */ 052 public String getId(); 053}