Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractGS2FieldSearch.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractGS2FieldSearch.java	(revision 25872)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractGS2FieldSearch.java	(revision 25885)
@@ -305,5 +305,5 @@
 					createParameter(INDEX_LANGUAGE_PARAM, param_list, lang);
 				}
-				
+
 				if (does_paging)
 				{
@@ -311,5 +311,5 @@
 					createParameter(START_PAGE_PARAM, param_list, lang);
 				}
-				
+
 				// create a multi param for the fields etc
 				// text box, field
@@ -665,28 +665,32 @@
 		addTermInfo(term_list, params, query_result);
 
-		if (query_result instanceof SolrQueryResult)
-		{
-			Element facet_list = this.doc.createElement(GSXML.FACET_ELEM + GSXML.LIST_MODIFIER);
-			result.appendChild(facet_list);
-
-			if(((SolrQueryResult) query_result).getFacetResults() != null)
-			{
-				for (FacetField facet : ((SolrQueryResult) query_result).getFacetResults())
+		if(does_faceting)
+		{
+			ArrayList<FacetWrapper> facets = getFacets(query_result);
+			if(facets != null)
+			{
+				Element facet_list = this.doc.createElement(GSXML.FACET_ELEM + GSXML.LIST_MODIFIER);
+				result.appendChild(facet_list);
+
+				for(FacetWrapper currentFacet : facets)
 				{
 					Element facet_elem = this.doc.createElement(GSXML.FACET_ELEM);
-					facet_elem.setAttribute(GSXML.NAME_ATT, facet.getName());
-	
-					for (FacetField.Count count : facet.getValues())
+					facet_elem.setAttribute(GSXML.NAME_ATT, currentFacet.getName());
+					facet_list.appendChild(facet_elem);
+					
+					HashMap<String, Long> countMap = currentFacet.getCounts();
+					
+					for(String countName : countMap.keySet())
 					{
-						if (count.getCount() > 0)
+						long countValue = countMap.get(countName);
+						if(countValue > 0)
 						{
 							Element count_elem = this.doc.createElement(GSXML.COUNT_ELEM);
-							count_elem.setAttribute(GSXML.NAME_ATT, count.getName());
-							count_elem.setTextContent("" + count.getCount());
-	
+							count_elem.setAttribute(GSXML.NAME_ATT, countName);
+							count_elem.setTextContent("" + countValue);
+
 							facet_elem.appendChild(count_elem);
 						}
 					}
-					facet_list.appendChild(facet_elem);
 				}
 			}
@@ -712,4 +716,7 @@
 	/** get the list of doc ranks */
 	abstract protected String[] getDocRanks(Object query_result);
+	
+	/** get the list of facets */
+	abstract protected ArrayList<FacetWrapper> getFacets(Object query_result);
 
 	/** add in term info if available */
Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractSearch.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractSearch.java	(revision 25872)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractSearch.java	(revision 25885)
@@ -62,4 +62,6 @@
 	/** does this service support asking for a subset of results? */
 	protected boolean does_chunking = false;
+	/** does this service support faceting search results */
+	protected boolean does_faceting = false;
 	/**
 	 * the default document type - use if all documents are the same type
Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2LuceneSearch.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2LuceneSearch.java	(revision 25872)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2LuceneSearch.java	(revision 25885)
@@ -21,4 +21,5 @@
 // Greenstone classes
 import java.io.File;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -30,4 +31,5 @@
 import org.greenstone.LuceneWrapper3.GS2LuceneQuery;
 import org.greenstone.LuceneWrapper3.LuceneQueryResult;
+import org.greenstone.gsdl3.util.FacetWrapper;
 import org.greenstone.gsdl3.util.GSFile;
 import org.greenstone.gsdl3.util.GSXML;
@@ -229,3 +231,8 @@
 		return true;
 	}
+	
+	protected ArrayList<FacetWrapper> getFacets(Object query_result)
+	{
+		return null;
+	}
 }
Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2MGPPSearch.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2MGPPSearch.java	(revision 25872)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2MGPPSearch.java	(revision 25885)
@@ -21,4 +21,5 @@
 import java.io.File;
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -28,4 +29,5 @@
 
 import org.apache.log4j.Logger;
+import org.greenstone.gsdl3.util.FacetWrapper;
 import org.greenstone.gsdl3.util.GSFile;
 import org.greenstone.gsdl3.util.GSXML;
@@ -336,3 +338,7 @@
 	}
 
+	protected ArrayList<FacetWrapper> getFacets(Object query_result)
+	{
+		return null;
+	}
 }
Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/FacetWrapper.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/FacetWrapper.java	(revision 25885)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/FacetWrapper.java	(revision 25885)
@@ -0,0 +1,40 @@
+/**********************************************************************
+ *
+ * FacetWrapper.java 
+ *
+ * Copyright 2004 The New Zealand Digital Library Project
+ *
+ * A component of the Greenstone digital library software
+ * from the New Zealand Digital Library Project at the
+ * University of Waikato, New Zealand.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *********************************************************************/
+package org.greenstone.gsdl3.util;
+
+import java.util.HashMap;
+
+public abstract class FacetWrapper
+{
+	protected String _name = null;
+	
+	public String getName()
+	{
+		return _name;
+	}
+	
+	public abstract HashMap<String, Long> getCounts();
+}
