001/* 002 * (C) Copyright 2010-2013 Nuxeo SA (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Olivier Grisel 016 */ 017package org.nuxeo.ecm.platform.suggestbox.service; 018 019import java.util.List; 020 021/** 022 * Pluggable service to generate user action suggestions based on text input and contextual data. 023 * <p> 024 * This services aims to build more natural user interfaces for search and navigation by trying to interpret and make 025 * explicit possible user intents. 026 * <p> 027 * Possible usages of this service: 028 * <ul> 029 * <li>make the top right JSF search box more useful with ajax auto-completion that leads to typed suggestions</li> 030 * <li>custom auto-complete field in layouts</li> 031 * <li>smart mobile application using a Content Automation operation for suggesting next operations / chains</li> 032 * </ul> 033 * 034 * @since 5.5 035 * @author ogrisel 036 */ 037public interface SuggestionService { 038 039 /** 040 * Call the suggesters registered for the given suggestion point mentioned in the context and aggregate the results. 041 * 042 * @param userInput text typed by the user 043 * @param context user context (with suggestPoint name and more) 044 * @return generated suggestion for the given input and context 045 */ 046 List<Suggestion> suggest(String userInput, SuggestionContext context) throws SuggestionException; 047 048 /** 049 * Call a single suggester registered under the provided name. 050 * 051 * @param userInput text typed by the user 052 * @param suggestionContext user context (with suggestPoint name and more) 053 * @param suggester the registration name of the suggester to use 054 * @return generated suggestion for the given input and context 055 */ 056 List<Suggestion> suggest(String searchKeywords, SuggestionContext suggestionContext, String suggester) 057 throws SuggestionException; 058 059}