I just resolved this issue - quick and easy way though!

   1. Created searchmenu.jsp with drop down selection to search from several
   directories passing the hidden value to search.jsp
   2. In search.jsp, for default value, I am searching the entire /html
   directory, I just left the code as is in search.jsp (), which creates the
   configuration from nutch-site.xml------bean = NutchBean.get(application,
   nutchConf);
   3. Added some conditions and created a new configuration for each
   selected value.  (So, we need as many nutch-site-XXX.xml files)

 if(id==null || id.equals("0")){ //access nutch-site.xml to search within
all sections
     nutchConf = NutchConfiguration.get(application);
    }
    else{
    if(id.equals("1")){
     nutchConf = createConfig("iconfig","nutch-site-int.xml");
    } else if(id.equals("2")){
     nutchConf = createConfig("aconfig","nutch-site-issue-admin.xml");
    }else if(id.equals("3")){
     nutchConf = createConfig("jconfig","nutch-site-join.xml");
....
And, here is the createConfig() method:

public Configuration createConfig(String attr,String xmlFile){
  Configuration nutchConf = (Configuration)application.getAttribute(attr);
      if (nutchConf  == null) {
       nutchConf = new Configuration();
          nutchConf.addResource("nutch-default.xml");
          nutchConf.addResource(xmlFile);
          application.setAttribute(attr,nutchConf);
   }
  return nutchConf;
  }


And, the clusterer try block could be trickier - you might get some weird
results while searching....added my code for ur reference----
after all above conditions, add this code....

try {
      clusterer = new
OnlineClustererFactory(nutchConf).getOnlineClusterer();
    } catch (PluginRuntimeException e) {

    }

    if(sectionId==null || sectionId=="0"){
     HITS_TO_CLUSTER =
nutchConf.getInt("extension.clustering.hits-to-cluster", 100);
        MAX_HITS_PER_PAGE = nutchConf.getInt("searcher.max.hits.per.page",
-1);
     bean = NutchBean.get(application, nutchConf);
    }else{
     HITS_TO_CLUSTER =
nutchConf.getInt("extension.clustering.hits-to-cluster", 100);
    MAX_HITS_PER_PAGE = nutchConf.getInt("searcher.max.hits.per.page", -1);
     bean = new NutchBean(nutchConf);
    }

Hope this helps!


On Mon, Apr 26, 2010 at 10:53 AM, BK <bk4...@gmail.com> wrote:

> Hello all,
>
> I have a requirement to search within multiple directories on the same
> server. Can I accomplish this task using nutch? Pls lemme know. Thanks!
>

Reply via email to