01: /**
02: * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, version 2.1, dated February 1999.
03: *
04: * This program is free software; you can redistribute it and/or modify
05: * it under the terms of the latest version of the GNU Lesser General
06: * Public License as published by the Free Software Foundation;
07: *
08: * This program is distributed in the hope that it will be useful,
09: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11: * GNU Lesser General Public License for more details.
12: *
13: * You should have received a copy of the GNU Lesser General Public License
14: * along with this program (LICENSE.txt); if not, write to the Free Software
15: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16: */package org.jamwiki;
17:
18: import java.util.Collection;
19: import org.jamwiki.model.Topic;
20:
21: /**
22: * This interface provides all methods needed for interacting with a search
23: * engine.
24: *
25: * @see org.jamwiki.WikiBase#getSearchEngine
26: */
27: public interface SearchEngine {
28:
29: /**
30: * Add a topic to the search index.
31: *
32: * @param topic The Topic object that is to be added to the index.
33: * @param links A collection containing the topic names for all topics that link
34: * to the current topic.
35: */
36: void addToIndex(Topic topic, Collection links);
37:
38: /**
39: * Remove a topic from the search index.
40: *
41: * @param topic The topic object that is to be removed from the index.
42: */
43: void deleteFromIndex(Topic topic);
44:
45: /**
46: * Find all documents that link to a specified topic.
47: *
48: * @param virtualWiki The virtual wiki for the topic.
49: * @param topicName The name of the topic.
50: * @return A collection of SearchResultEntry objects for all documents that
51: * link to the topic.
52: */
53: Collection findLinkedTo(String virtualWiki, String topicName);
54:
55: /**
56: * Find all documents that contain a specific search term, ordered by relevance.
57: *
58: * @param virtualWiki The virtual wiki for the topic.
59: * @param text The search term being searched for.
60: * @return A collection of SearchResultEntry objects for all documents that
61: * contain the search term.
62: */
63: Collection findResults(String virtualWiki, String text);
64:
65: /**
66: * Refresh the current search index by re-visiting all topic pages.
67: *
68: * @throws Exception Thrown if any error occurs while re-indexing the Wiki.
69: */
70: void refreshIndex() throws Exception;
71: }
|