diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/application/ApplicationUtils.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/application/ApplicationUtils.java new file mode 100644 index 000000000..1aeb7c500 --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/application/ApplicationUtils.java @@ -0,0 +1,29 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.application; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import edu.cornell.mannlib.vitro.webapp.modules.Application; + +/** + * Tools for working with the current Application instance. + */ +public class ApplicationUtils { + private static final Log log = LogFactory.getLog(ApplicationUtils.class); + + private static volatile Application instance; + + public static Application instance() { + try { + instance.getClass(); + return instance; + } catch (NullPointerException e) { + log.error("Called for Application before it was available", e); + throw new IllegalStateException( + "Called for Application before it was available", e); + } + } + +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/Application.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/Application.java new file mode 100644 index 000000000..cbe44766d --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/Application.java @@ -0,0 +1,35 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.modules; + +import javax.servlet.ServletContext; + +import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchEngine; + +/** + * The interface that holds the modules and extensions together. + */ +public interface Application { + ServletContext getServletContext(); + + SearchEngine getSearchEngine(); + + public interface Component { + enum LifecycleState { + NEW, ACTIVE, STOPPED + } + + void startup(Application application, ComponentStartupStatus ss); + + void shutdown(Application application); + } + + public static interface Module extends Component { + // Nothing except lifecycle so far. + } + + public static interface Extension extends Component { + // Nothing except lifecycle so far. + } + +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/ComponentStartupStatus.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/ComponentStartupStatus.java new file mode 100644 index 000000000..6edc6822c --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/ComponentStartupStatus.java @@ -0,0 +1,21 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.modules; + +/** + * A facade for the StartupStatus that already knows who the + * ServletContextListener is. + */ +public interface ComponentStartupStatus { + void info(String message); + + void info(String message, Throwable cause); + + void warning(String message); + + void warning(String message, Throwable cause); + + void fatal(String message); + + void fatal(String message, Throwable cause); +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchEngine.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchEngine.java new file mode 100644 index 000000000..0b8e92d31 --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchEngine.java @@ -0,0 +1,90 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.modules.searchEngine; + +import java.util.Collection; + +import edu.cornell.mannlib.vitro.webapp.modules.Application; + +/** + * The principle interface for the SearchEngine. All search-related objects are + * created by these methods. + */ +public interface SearchEngine extends Application.Module { + + /** + * Check to see whether the SearchEngine is alive. + * + * @throws SearchEngineException + * if the SearchEngine does not respond. + */ + void ping() throws SearchEngineException; + + // ---------------------------------------------------------------------- + // Indexing operations + // ---------------------------------------------------------------------- + + /** + * Create a SearchInputDocument that can be populated and added to the + * index. + */ + SearchInputDocument createInputDocument(); + + /** + * Add documents to the search index. + */ + void add(SearchInputDocument... docs) throws SearchEngineException; + + /** + * Add documents to the search index. + */ + void add(Collection docs) throws SearchEngineException; + + /** + * Explicitly commit all pending changes, and wait until they are visible to + * the search. + */ + void commit() throws SearchEngineException; + + /** + * Explicitly commit all pending changes, and optionally wait until they are + * visible to the search. + */ + void commit(boolean wait) throws SearchEngineException; + + /** + * Delete documents from the search index, by unique ID. + */ + void deleteById(String... ids) throws SearchEngineException; + + /** + * Delete documents from the search index, by unique ID. + */ + void deleteById(Collection ids) throws SearchEngineException; + + /** + * Delete documents from the search index if they satisfy the query. + */ + void deleteByQuery(String query) throws SearchEngineException; + + // ---------------------------------------------------------------------- + // Searching operations + // ---------------------------------------------------------------------- + + /** + * Create a SearchQuery that can be populated and used for searching. + */ + SearchQuery createQuery(); + + /** + * Convenience method to create a SearchQuery and set the query text in one + * step. + */ + SearchQuery createQuery(String queryText); + + /** + * Query the search index and return the results. Response is never null. + */ + SearchResponse query(SearchQuery query) throws SearchEngineException; + +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchEngineException.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchEngineException.java new file mode 100644 index 000000000..33fa85892 --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchEngineException.java @@ -0,0 +1,26 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.modules.searchEngine; + +/** + * Indicates a problem with a request to the SearchEngine. + */ +public class SearchEngineException extends Exception { + + public SearchEngineException() { + super(); + } + + public SearchEngineException(String message) { + super(message); + } + + public SearchEngineException(Throwable cause) { + super(cause); + } + + public SearchEngineException(String message, Throwable cause) { + super(message, cause); + } + +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchFacetField.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchFacetField.java new file mode 100644 index 000000000..0b3c2b68a --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchFacetField.java @@ -0,0 +1,39 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.modules.searchEngine; + +import java.util.List; + +/** + * Holds the faceting information from a query result. + */ +public interface SearchFacetField { + + /** + * The name of the field that was faceted. Never null. + */ + String getName(); + + /** + * The different facet values. May return an empty list, but never null. + */ + List getValues(); + + /** + * Holds one facet from this field. + */ + public interface Count { + + /** + * The value of this facet. Never null. + */ + String getName(); + + /** + * The number of times that the value occurs in the results. + */ + long getCount(); + + } + +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchInputDocument.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchInputDocument.java new file mode 100644 index 000000000..34e2dbd10 --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchInputDocument.java @@ -0,0 +1,68 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.modules.searchEngine; + +import java.util.Collection; +import java.util.Map; + +/** + * A collection of fields and values that will be used to build a record in the + * search index. + */ +public interface SearchInputDocument { + /** + * Create a field that can be populated and added to the document. + */ + SearchInputField createField(String name); + + /** + * Put the field into the document. If a field with this name already exists + * in the document, it will be replaced. + */ + void addField(SearchInputField field); + + /** + * Create a field with this name and values, and put it into the document. If + * a field with this name already exists in the document, it will be + * replaced. + */ + void addField(String name, Object... values); + + /** + * Create a field with this name and values, and put it into the document. If + * a field with this name already exists in the document, it will be + * replaced. + */ + void addField(String name, Collection values); + + /** + * Create a field with this name, boost level and values, and put it into + * the document. If a field with this name already exists in the document, + * it will be replaced. + */ + void addField(String name, float boost, Object... values); + + /** + * Create a field with this name, boost level and values, and put it into + * the document. If a field with this name already exists in the document, + * it will be replaced. + */ + void addField(String name, float boost, Collection values); + + /** + * Set a boost level for the document as a whole. + */ + void setDocumentBoost(float searchBoost); + + float getDocumentBoost(); + + /** + * May return null. + */ + SearchInputField getField(String name); + + /** + * May return an empty map, but never null. + */ + Map getFieldMap(); +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchInputField.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchInputField.java new file mode 100644 index 000000000..2c1ed9e64 --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchInputField.java @@ -0,0 +1,42 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.modules.searchEngine; + +import java.util.Collection; + +/** + * A named field with a name and one or more values. This can be added to a + * SearchInputDocument and inserted into the search index. + */ +public interface SearchInputField { + + /** + * Add values to this field. + */ + void addValues(Object... values); + + /** + * Add values to this field. + */ + void addValues(Collection values); + + /** + * Set the boost level for this field. + */ + void setBoost(float boost); + + String getName(); + + float getBoost(); + + /** + * May return an empty collection, but never null. + */ + Collection getValues(); + + /** + * May return null. + */ + Object getFirstValue(); + +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchQuery.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchQuery.java new file mode 100644 index 000000000..10977367a --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchQuery.java @@ -0,0 +1,137 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.modules.searchEngine; + +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * A collection of search terms that will be used to query the search index. + * + * Each of the "set" and "add" methods will return the searchQuery itself, so + * calls can easily be chained together. + */ +public interface SearchQuery { + public enum Order { + ASC, DESC + } + + /** + * Set the text of the query. This will be parsed using Lucene query syntax. + */ + SearchQuery setQuery(String query); + + /** + * Where in the ordered list of result documents should the response begin? + * That is, how many of the results should be skipped? (allows paging of + * results) + */ + SearchQuery setStart(int start); + + /** + * What is the maximum number of documents that will be returned from the + * query? + */ + SearchQuery setRows(int rows); + + /** + * Which fields should be returned from the query? + */ + SearchQuery addFields(String... names); + + /** + * Which fields should be returned from the query? + */ + SearchQuery addFields(Collection names); + + /** + * What field should be used to sort the results, and in what order? + */ + SearchQuery addSortField(String name, Order order); + + /** + * Restrict the results by thisw query. + */ + SearchQuery addFilterQuery(String filterQuery); + + /** + * Restrict the results by these queries. + */ + SearchQuery addFilterQueries(String... filterQueries); + + /** + * Should the results be faceted? + */ + SearchQuery setFaceting(boolean b); + + /** + * What fields should be used to facet the results? + */ + SearchQuery addFacetFields(String... fields); + + /** + * Add queries that can be used to facet the results. + */ + SearchQuery addFacetQueries(String... queries); + + /** + * Facet having fewer hits will be excluded from the list. + */ + SearchQuery setFacetMinCount(int cnt); + + /** + * Add a system-dependent parameter to the query. + */ + SearchQuery addParameter(String name, String... values); + + /** + * Get the text of the query. + */ + String getQuery(); + + int getStart(); + + /** + * A value of -1 means that no limit has been specified. + */ + int getRows(); + + /** + * May return an empty set, but never null. + */ + Set getFieldsToReturn(); + + /** + * May return an empty map, but never null. + */ + Map getSortFields(); + + /** + * May return an empty set, but never null. + */ + Set getFilters(); + + boolean isFaceting(); + + /** + * May return an empty set, but never null. + */ + Set getFacetFields(); + + /** + * May return an empty set, but never null. + */ + Set getFacetQueries(); + + /** + * A value of -1 means that no limit has been specified. + */ + int getFacetMinCount(); + + /** + * May return an empty map, but never null. + */ + Map> getParameterMap(); +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchResponse.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchResponse.java new file mode 100644 index 000000000..912fff67e --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchResponse.java @@ -0,0 +1,34 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.modules.searchEngine; + +import java.util.List; +import java.util.Map; + +/** + * The response to a query against the search index. It includes a list of the + * results, as well as an optional collection of facet fields. + */ +public interface SearchResponse { + + /** + * May return an empty list, but never null. + */ + SearchResultDocumentList getResults(); + + /** + * May return an empty map, but never null. + */ + Map>> getHighlighting(); + + /** + * May return null. + */ + SearchFacetField getFacetField(String name); + + /** + * May return an empty list, but never null. + */ + List getFacetFields(); + +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchResultDocument.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchResultDocument.java new file mode 100644 index 000000000..3583b5576 --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchResultDocument.java @@ -0,0 +1,47 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.modules.searchEngine; + +import java.util.Collection; +import java.util.Map; + +/** + * The concrete representation of a document in the search index. Obtained in + * response to a query. + */ +public interface SearchResultDocument { + + /** + * A document identifier that can be used in SearchEngine.deleteById(); + * Never null. + */ + public String getUniqueId(); + + /** + * May return an empty collection, but never null. + */ + public Collection getFieldNames(); + + /** + * May return null. + */ + public Object getFirstValue(String name); + + /** + * Gets the first value for the named field, and converts it to a String. + * May return null. + */ + public String getStringValue(String name); + + /** + * Get the values for the named field. May return an empty collection, but + * never null. + */ + public Collection getFieldValues(String name); + + /** + * May return an empty map, but never null. The values collection for any + * key may be empty, but never null. + */ + public Map> getFieldValuesMap(); +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchResultDocumentList.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchResultDocumentList.java new file mode 100644 index 000000000..37563e45d --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchResultDocumentList.java @@ -0,0 +1,23 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.modules.searchEngine; + +/** + * A collection of results that are returned from a query. + */ +public interface SearchResultDocumentList extends + Iterable { + + /** + * The number of documents that would satisfy the query + */ + long getNumFound(); + + /** + * The number of documents that are included in this result. + */ + int size(); + + SearchResultDocument get(int i); + +} diff --git a/webapp/test/stubs/edu/cornell/mannlib/vitro/webapp/modules/ApplicationStub.java b/webapp/test/stubs/edu/cornell/mannlib/vitro/webapp/modules/ApplicationStub.java new file mode 100644 index 000000000..39f2e892b --- /dev/null +++ b/webapp/test/stubs/edu/cornell/mannlib/vitro/webapp/modules/ApplicationStub.java @@ -0,0 +1,61 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package stubs.edu.cornell.mannlib.vitro.webapp.modules; + +import java.lang.reflect.Field; + +import javax.servlet.ServletContext; + +import edu.cornell.mannlib.vitro.webapp.application.ApplicationUtils; +import edu.cornell.mannlib.vitro.webapp.modules.Application; +import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchEngine; + +/** + * TODO + */ +public class ApplicationStub implements Application { + /** + * Create an ApplicationStub and set it as the instance in ApplicationUtils. + */ + public static void setup(ServletContext ctx, SearchEngine searchEngine) { + ApplicationStub instance = new ApplicationStub(ctx, searchEngine); + try { + Field instanceField = ApplicationUtils.class + .getDeclaredField("instance"); + instanceField.setAccessible(true); + instanceField.set(null, instance); + } catch (Exception e) { + throw new IllegalStateException(e); + } + } + + // ---------------------------------------------------------------------- + // Stub infrastructure + // ---------------------------------------------------------------------- + + private final ServletContext ctx; + private final SearchEngine searchEngine; + + public ApplicationStub(ServletContext ctx, SearchEngine searchEngine) { + this.ctx = ctx; + this.searchEngine = searchEngine; + } + + // ---------------------------------------------------------------------- + // Stub methods + // ---------------------------------------------------------------------- + + @Override + public ServletContext getServletContext() { + return ctx; + } + + @Override + public SearchEngine getSearchEngine() { + return searchEngine; + } + + // ---------------------------------------------------------------------- + // Un-implemented methods + // ---------------------------------------------------------------------- +} diff --git a/webapp/test/stubs/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchEngineStub.java b/webapp/test/stubs/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchEngineStub.java new file mode 100644 index 000000000..77dd3b488 --- /dev/null +++ b/webapp/test/stubs/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchEngineStub.java @@ -0,0 +1,136 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package stubs.edu.cornell.mannlib.vitro.webapp.modules.searchEngine; + +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import edu.cornell.mannlib.vitro.webapp.modules.Application; +import edu.cornell.mannlib.vitro.webapp.modules.ComponentStartupStatus; +import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchEngine; +import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchEngineException; +import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchInputDocument; +import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchQuery; +import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchResponse; + +/** + * TODO + */ +public class SearchEngineStub implements SearchEngine { + // ---------------------------------------------------------------------- + // Stub infrastructure + // ---------------------------------------------------------------------- + + Map queryResponses = new HashMap<>(); + + public void setQueryResponse(String queryText, SearchResponseStub response) { + queryResponses.put(queryText, response); + } + + // ---------------------------------------------------------------------- + // Stub methods + // ---------------------------------------------------------------------- + + @Override + public SearchQuery createQuery() { + return new SearchQueryStub(); + } + + @Override + public SearchQuery createQuery(String queryText) { + return new SearchQueryStub(queryText); + } + + @Override + public SearchResponse query(SearchQuery query) throws SearchEngineException { + SearchResponseStub response = queryResponses.get(query.getQuery()); + if (response == null) { + return SearchResponseStub.EMPTY_RESPONSE; + } else { + return response; + } + } + + + // ---------------------------------------------------------------------- + // Un-implemented methods + // ---------------------------------------------------------------------- + + + + @Override + public void startup(Application application, ComponentStartupStatus ss) { + // TODO Auto-generated method stub + throw new RuntimeException( + "SearchEngineStub.startup() not implemented."); + } + + @Override + public void shutdown(Application application) { + // TODO Auto-generated method stub + throw new RuntimeException( + "SearchEngineStub.shutdown() not implemented."); + } + + @Override + public void ping() throws SearchEngineException { + // TODO Auto-generated method stub + throw new RuntimeException("SearchEngineStub.ping() not implemented."); + } + + @Override + public SearchInputDocument createInputDocument() { + // TODO Auto-generated method stub + throw new RuntimeException( + "SearchEngineStub.createInputDocument() not implemented."); + } + + @Override + public void add(SearchInputDocument... docs) throws SearchEngineException { + // TODO Auto-generated method stub + throw new RuntimeException("SearchEngineStub.add() not implemented."); + } + + @Override + public void add(Collection docs) + throws SearchEngineException { + // TODO Auto-generated method stub + throw new RuntimeException("SearchEngineStub.add() not implemented."); + } + + @Override + public void commit() throws SearchEngineException { + // TODO Auto-generated method stub + throw new RuntimeException("SearchEngineStub.commit() not implemented."); + } + + @Override + public void commit(boolean wait) throws SearchEngineException { + // TODO Auto-generated method stub + throw new RuntimeException("SearchEngineStub.commit() not implemented."); + } + + @Override + public void deleteById(String... ids) throws SearchEngineException { + // TODO Auto-generated method stub + throw new RuntimeException( + "SearchEngineStub.deleteById() not implemented."); + } + + @Override + public void deleteById(Collection ids) throws SearchEngineException { + // TODO Auto-generated method stub + throw new RuntimeException( + "SearchEngineStub.deleteById() not implemented."); + } + + @Override + public void deleteByQuery(String query) throws SearchEngineException { + // TODO Auto-generated method stub + throw new RuntimeException( + "SearchEngineStub.deleteByQuery() not implemented."); + } + +} diff --git a/webapp/test/stubs/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchQueryStub.java b/webapp/test/stubs/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchQueryStub.java new file mode 100644 index 000000000..d24e3ec26 --- /dev/null +++ b/webapp/test/stubs/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchQueryStub.java @@ -0,0 +1,38 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package stubs.edu.cornell.mannlib.vitro.webapp.modules.searchEngine; + +import edu.cornell.mannlib.vitro.webapp.searchengine.base.BaseSearchQuery; + +/** + * TODO + */ +public class SearchQueryStub extends BaseSearchQuery { + // ---------------------------------------------------------------------- + // Stub infrastructure + // ---------------------------------------------------------------------- + + /** + * @param queryText + */ + public SearchQueryStub() { + super(); + } + + /** + * @param queryText + */ + public SearchQueryStub(String queryText) { + super(); + setQuery(queryText); + } + + // ---------------------------------------------------------------------- + // Stub methods + // ---------------------------------------------------------------------- + + // ---------------------------------------------------------------------- + // Un-implemented methods + // ---------------------------------------------------------------------- + +} diff --git a/webapp/test/stubs/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchResponseStub.java b/webapp/test/stubs/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchResponseStub.java new file mode 100644 index 000000000..6325573d2 --- /dev/null +++ b/webapp/test/stubs/edu/cornell/mannlib/vitro/webapp/modules/searchEngine/SearchResponseStub.java @@ -0,0 +1,60 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package stubs.edu.cornell.mannlib.vitro.webapp.modules.searchEngine; + +import java.util.List; +import java.util.Map; + +import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchFacetField; +import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchResponse; +import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchResultDocumentList; + +/** + * TODO + */ +public class SearchResponseStub implements SearchResponse { + + // ---------------------------------------------------------------------- + // Stub infrastructure + // ---------------------------------------------------------------------- + + public static final SearchResponseStub EMPTY_RESPONSE = null; + + + // ---------------------------------------------------------------------- + // Stub methods + // ---------------------------------------------------------------------- + + // ---------------------------------------------------------------------- + // Un-implemented methods + // ---------------------------------------------------------------------- + + @Override + public SearchResultDocumentList getResults() { + // TODO Auto-generated method stub + throw new RuntimeException( + "SearchResponseStub.getResults() not implemented."); + } + + @Override + public Map>> getHighlighting() { + // TODO Auto-generated method stub + throw new RuntimeException( + "SearchResponseStub.getHighlighting() not implemented."); + } + + @Override + public SearchFacetField getFacetField(String name) { + // TODO Auto-generated method stub + throw new RuntimeException( + "SearchResponseStub.getFacetField() not implemented."); + } + + @Override + public List getFacetFields() { + // TODO Auto-generated method stub + throw new RuntimeException( + "SearchResponseStub.getFacetFields() not implemented."); + } + +}