001/* 002 * (C) Copyright 2010-2013 Nuxeo SA (http://nuxeo.com/) and others. 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 * 016 * Contributors: 017 * Olivier Grisel 018 */ 019package org.nuxeo.ecm.platform.suggestbox.service; 020 021import java.util.List; 022 023/** 024 * Pluggable service to generate user action suggestions based on text input and contextual data. 025 * <p> 026 * This services aims to build more natural user interfaces for search and navigation by trying to interpret and make 027 * explicit possible user intents. 028 * <p> 029 * Possible usages of this service: 030 * <ul> 031 * <li>make the top right JSF search box more useful with ajax auto-completion that leads to typed suggestions</li> 032 * <li>custom auto-complete field in layouts</li> 033 * <li>smart mobile application using a Content Automation operation for suggesting next operations / chains</li> 034 * </ul> 035 * 036 * @since 5.5 037 * @author ogrisel 038 */ 039public interface SuggestionService { 040 041 /** 042 * Call the suggesters registered for the given suggestion point mentioned in the context and aggregate the results. 043 * 044 * @param userInput text typed by the user 045 * @param context user context (with suggestPoint name and more) 046 * @return generated suggestion for the given input and context 047 */ 048 List<Suggestion> suggest(String userInput, SuggestionContext context) throws SuggestionException; 049 050 /** 051 * Call a single suggester registered under the provided name. 052 * 053 * @param userInput text typed by the user 054 * @param suggestionContext user context (with suggestPoint name and more) 055 * @param suggester the registration name of the suggester to use 056 * @return generated suggestion for the given input and context 057 */ 058 List<Suggestion> suggest(String searchKeywords, SuggestionContext suggestionContext, String suggester) 059 throws SuggestionException; 060 061}