Skip to content

Apache Lucene open-source search software

Fulcrum-based service declaration of a search service. This is actually quite a Lucene-specific interface declaration.

Kelvin Tan5ab813ac7224
diff --git a/sandbox/contributions/fulcrum/SearchService.java b/sandbox/contributions/fulcrum/SearchService.java
new file mode 100644
index 00000000000..e8e05a2684f
--- /dev/null
+++ b/sandbox/contributions/fulcrum/SearchService.java
@@ -0,0 +1,72 @@
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.search.Filter;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.document.Document;
+import org.apache.fulcrum.ServiceException;
+import org.apache.fulcrum.Service;
+
+import java.util.Map;
+
+/**
+ * A SearchService based on the Fulcrum services framework.
+ */
+public interface SearchService extends Service
+{
+ /**
+ * The key in the TurbineResources.properties that references this
+ * service.
+ */
+ public static final String SERVICE_NAME = "SearchService";
+
+ /**
+ * The key in SearchService properties in
+ * TurbineResources.properties. The location of the index.
+ * Assumes a FSDirectory is used.
+ */
+ public static final String INDEX_LOCATION_KEY = "index.location";
+
+ /**
+ * Performs a search.
+ *
+ * @param Query to search on.
+ * @return SearchResults
+ * @exception ServiceException
+ */
+ public SearchResults search(Query query) throws ServiceException;
+
+ /**
+ * Performs a search, using a filter to filter the results.
+ *
+ * @param Query to search on.
+ * @param Filter to filter the results through.
+ * @return SearchResults
+ * @exception ServiceException
+ */
+ public SearchResults search(Query query, Filter filter) throws ServiceException;
+
+ /**
+ * Performs a search, using a filter to filter the results, then
+ * return the results within the range specified.
+ *
+ * @param Query to search on.
+ * @return SearchResults
+ * @exception ServiceException
+ */
+ public SearchResults search(Query query, Filter filter,
+ int from, int to) throws ServiceException;
+
+ /**
+ * Refresh the entire index.
+ */
+ public void batchIndex() throws ServiceException;
+
+ /**
+ * Is the indexer currently indexing?
+ */
+ public boolean isIndexing();
+
+ /**
+ * Get the analyzer used.
+ */
+ public Analyzer getAnalyzer();
+}