1 /*******************************************************************************
2  * Copyright (c) 2000, 2015 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.help.search;
15 
16 import org.eclipse.core.runtime.IStatus;
17 
18 /**
19  * A collector for the search hits (asynchronously) returned by the help search
20  * participants.
21  * <p>
22  * This interface is intended to be implemented by clients and passed to the
23  * search engine instance.
24  *
25  * @since 3.1
26  */
27 public interface ISearchEngineResultCollector {
28 	/**
29 	 * Accepts a new search result object.
30 	 *
31 	 * @param searchResult
32 	 *            the new search result
33 	 */
accept(ISearchEngineResult searchResult)34 	void accept(ISearchEngineResult searchResult);
35 
36 	/**
37 	 * Accepts an array of new search results.
38 	 *
39 	 * @param searchResults
40 	 *            an array of search result objects
41 	 */
accept(ISearchEngineResult[] searchResults)42 	void accept(ISearchEngineResult[] searchResults);
43 
44 	/**
45 	 * Notifies the collector that an error has occured in the search engine.
46 	 * The kinds of errors that are reported this way are not abnormal problems
47 	 * or internal errors. Unexpected problems should be left to the job manager
48 	 * to handle by throwing a <code>CoreException</code>. Use this method to
49 	 * report errors that are expected to occur from time to time (e.g., server
50 	 * down, server timeout, incorrect URL etc.).
51 	 *
52 	 * @param status
53 	 *            the reported error status
54 	 */
error(IStatus status)55 	void error(IStatus status);
56 }
57