Index: /main/trunk/gli/src/org/greenstone/gatherer/cdm/IndexingManager.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/cdm/IndexingManager.java	(revision 36152)
+++ /main/trunk/gli/src/org/greenstone/gatherer/cdm/IndexingManager.java	(revision 36153)
@@ -53,12 +53,12 @@
 
     private IndexOptionManager option_manager = null;
-    private IndexManager index_manager = null;
+    private SearchIndexManager index_manager = null;
     private BuildTypeManager build_type_manager = null;
-
+    private SortFieldManager sortfield_manager = null;
+    private FacetManager facet_manager = null;
 
     private String build_type = null;
 
     private Control controls = null;
-
 
     public IndexingManager()
@@ -67,11 +67,15 @@
 	build_type = build_type_manager.getBuildType();
 	option_manager = new IndexOptionManager(build_type);
-	if (build_type.equals(BuildTypeManager.BUILD_TYPE_MG)) {
-	    index_manager = new IndexManager(CollectionDesignManager.collect_config.getMGIndexes(), build_type);
+	if (isMG()) {
+	    index_manager = new SearchIndexManager(CollectionDesignManager.collect_config.getMGIndexes(), build_type);
 	} else {
-	    index_manager = new IndexManager(CollectionDesignManager.collect_config.getMGPPIndexes(), build_type);
-	}
-    }
-
+	    index_manager = new SearchIndexManager(CollectionDesignManager.collect_config.getMGPPIndexes(), build_type);
+	}
+	// we always create the managers, but only display the controls if we
+	// are Lucene/SOLR
+	sortfield_manager = new SortFieldManager(CollectionDesignManager.collect_config.getSorts(), build_type);
+	facet_manager = new FacetManager(CollectionDesignManager.collect_config.getFacets(), build_type);
+
+    }
     public boolean isMGPP() {
 	return build_type_manager.isMGPP();
@@ -84,4 +88,8 @@
     public boolean isMG() {
 	return build_type_manager.isMG();
+    }
+
+    public boolean isSOLR() {
+	return build_type_manager.isSOLR();
     }
 
@@ -130,4 +138,9 @@
 	JPanel main_index_pane = null;
 	JPanel index_options_panel = null;
+
+	JPanel index_sort_facet_panel = null;
+    // these get added/removed depending on indexer in use
+    private JPanel sortfield_panel = null;
+    private JPanel facet_panel = null;
 
 	public IndexingControl() {
@@ -138,12 +151,23 @@
 	    
 	    JPanel build_type_panel = (JPanel)build_type_manager.getControls();
-	    JPanel index_panel = (JPanel)index_manager.getControls();
 	    index_options_panel = (JPanel)option_manager.getControls();
-                       
-            
+
+	    index_sort_facet_panel = new JPanel();
+	    
+	    index_sort_facet_panel.setLayout(new GridLayout(0,1));
+	    JPanel index_panel = (JPanel)index_manager.getControls(); 
+	    index_sort_facet_panel.add(index_panel);
+	    if (isLucene() || isSOLR() ) {
+		sortfield_panel = (JPanel)sortfield_manager.getControls();
+		index_sort_facet_panel.add(sortfield_panel);
+	    }
+	    if (isSOLR()) {
+		facet_panel = (JPanel)facet_manager.getControls();
+		index_sort_facet_panel.add(facet_panel);
+            }
 	    main_index_pane = new JPanel();
 	    main_index_pane.setLayout(new BorderLayout());
 	    main_index_pane.add(build_type_panel, BorderLayout.NORTH);
-	    main_index_pane.add(index_panel, BorderLayout.CENTER);
+	    main_index_pane.add(index_sort_facet_panel, BorderLayout.CENTER);
 	    main_index_pane.add(index_options_panel, BorderLayout.SOUTH);
 	    main_index_pane.setComponentOrientation(Dictionary.getOrientation());
@@ -156,4 +180,6 @@
 	    build_type_manager.addBuildTypeListener(this);
 	    build_type_manager.addBuildTypeListener(index_manager);
+	    build_type_manager.addBuildTypeListener(sortfield_manager);
+	    build_type_manager.addBuildTypeListener(facet_manager);
 	    build_type_manager.addBuildTypeListener(option_manager);
 	}
@@ -169,7 +195,33 @@
 		return;
 	    }
+	    if (hasSorts(new_build_type) && !hasSorts(build_type)) {
+		sortfield_panel = (JPanel)sortfield_manager.getControls();
+		index_sort_facet_panel.add(sortfield_panel);
+		// add sort panel
+	    }
+	    if (hasSorts(build_type) && ! hasSorts(new_build_type)) {
+		// remove sort panel
+		index_sort_facet_panel.remove(sortfield_panel);
+	    } 
+	    if (hasFacets(new_build_type) && ! hasFacets(build_type)) {
+		// add facet
+		facet_panel = (JPanel)facet_manager.getControls();
+		index_sort_facet_panel.add(facet_panel);
+	    } 
+	    if (hasFacets(build_type) && ! hasFacets(new_build_type)) {
+		// remove facet pane
+		index_sort_facet_panel.remove(facet_panel);
+	    }
  	    build_type = new_build_type;
 	}
 
+	private boolean hasSorts(String build_type) {
+	    return build_type.equals(BuildTypeManager.BUILD_TYPE_LUCENE) || build_type.equals(BuildTypeManager.BUILD_TYPE_SOLR);
+	}
+	private boolean hasFacets(String build_type) {
+	    return build_type.equals(BuildTypeManager.BUILD_TYPE_SOLR);
+
+	}
+
     }
 }
