KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portlets > content > search > component > UIContentSearcher


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

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 /**
12  * @author Tuan Nguyen (tuan08@users.sourceforge.net)
13  * @since Aug 27, 2004
14  * @version $Id: UIContentSearcher.java,v 1.1 2004/10/25 03:48:11 tuan08 Exp $
15  */

16 public class UIContentSearcher extends UISearcher {
17   private IndexingService service_ ;
18   private List modules_ ;
19   public UIContentSearcher(IndexingService service) throws Exception JavaDoc {
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 JavaDoc {
32     Searcher searcher = service_.getSearcher() ;
33     return searcher ;
34   }
35   
36   public void quickSearch(String JavaDoc term, List fields) throws Exception JavaDoc {
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