1 5 package org.exoplatform.portlets.content.search.component; 6 7 import java.util.*; 8 import org.exoplatform.faces.search.component.UISearchSummary; 9 import org.exoplatform.faces.search.component.UISearcher; 10 import org.exoplatform.services.indexing.*; 11 16 public class UIContentSearcher extends UISearcher { 17 private IndexingService service_ ; 18 private List modules_ ; 19 public UIContentSearcher(IndexingService service) throws Exception { 20 super(service) ; 21 setId("UISearcher") ; 22 service_ = service ; 23 modules_ = new ArrayList() ; 24 Iterator i = service.getIndexerPlugins().iterator(); 25 while(i.hasNext()) { 26 IndexerPlugin plugin =(IndexerPlugin) i.next() ; 27 modules_.add(plugin.getPluginIdentifier()); 28 } 29 } 30 31 public Searcher getSearcher() throws Exception { 32 Searcher searcher = service_.getSearcher() ; 33 return searcher ; 34 } 35 36 public void quickSearch(String term, List fields) throws Exception { 37 MultipleFieldSearchInput searchInput = new MultipleFieldSearchInput(fields) ; 38 searchInput.setTerm(term) ; 39 Searcher searcher = getSearcher() ; 40 HitPageList result = searcher.search(searchInput, modules_) ; 41 UISearchSummary uiSummary = 42 (UISearchSummary)this.getChildComponentOfType(UISearchSummary.class) ; 43 uiSummary.setSearchResult(result) ; 44 this.setRenderedComponent(UISearchSummary.class) ; 45 } 46 } | Popular Tags |