001/*
002    Licensed to the Apache Software Foundation (ASF) under one
003    or more contributor license agreements.  See the NOTICE file
004    distributed with this work for additional information
005    regarding copyright ownership.  The ASF licenses this file
006    to you under the Apache License, Version 2.0 (the
007    "License"); you may not use this file except in compliance
008    with the License.  You may obtain a copy of the License at
009
010       http://www.apache.org/licenses/LICENSE-2.0
011
012    Unless required by applicable law or agreed to in writing,
013    software distributed under the License is distributed on an
014    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015    KIND, either express or implied.  See the License for the
016    specific language governing permissions and limitations
017    under the License.    
018 */
019package org.apache.wiki.search;
020
021import java.io.IOException;
022import java.util.Collection;
023
024import org.apache.wiki.WikiContext;
025import org.apache.wiki.WikiPage;
026import org.apache.wiki.WikiProvider;
027import org.apache.wiki.api.exceptions.ProviderException;
028
029/**
030 *  Interface for the search providers that handle searching the Wiki
031 *
032 *  @since 2.2.21.
033 */
034public interface SearchProvider extends WikiProvider
035{
036    /**
037     * Delete a page from the search index
038     * @param page Page to remove from search index
039     */
040    void pageRemoved(WikiPage page);
041
042    /**
043     *  Adds a WikiPage for indexing queue. This is called a queue, since
044     *  this method is expected to return pretty quickly, and indexing to
045     *  be done in a separate thread.
046     *
047     *  @param page The WikiPage to be indexed.
048     */
049    void reindexPage(WikiPage page);
050
051    /**
052     * Search for pages matching a search query
053     * @param query query to search for
054     * @param wikiContext the context within which to run the search
055     * @return collection of pages that match query
056     * @throws ProviderException if the search provider failed.
057     * @throws IOException if for some reason the query could not be executed.
058     */
059    Collection< SearchResult > findPages(String query, WikiContext wikiContext) throws ProviderException, IOException;
060}