Update of /cvsroot/nutch/nutch/src/web/jsp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23027/src/web/jsp
Modified Files: search.jsp Added Files: refine-query-init.jsp refine-query.jsp Log Message: Add ontology plugin and its application of query refinement. --- NEW FILE: refine-query.jsp --- <% // 20041129, Mike Pan and John Xing // Displays query-refinement hypertext based on ontology. // Try to be simple here. No mixing with other features such as clustering. // Please check refine-query-init.jsp, which does necessary initialization. List refineList = new ArrayList(); if (ontology != null) { Iterator iter = ontology.subclasses(queryString); while (iter.hasNext()) { refineList.add((String)iter.next()); } } bean.LOG.info("Outputting refine query list"); if (refineList.size() > 0) { %> <div> Refine your search: <% for (int i=0; i<refineList.size(); i++) { String searchTerm = (String) refineList.get(i); String searchTermHTML = net.nutch.html.Entities.encode(searchTerm); String searchQuery = "query="+searchTermHTML; String searchURL = "/search.jsp?"+ searchQuery; %> <a href="<%=searchURL%>"><%=searchTerm%></a> | <% } %> </div><br> <% } %> --- NEW FILE: refine-query-init.jsp --- <%! // 20041129, Mike Pan and John Xing // Initiates Ontology ontology and loads in all owl files. // Any problem (e.g., missing owl file or exception) will have this plugin // siliently ignored. // Please check ./refine-query.jsp, which provides query-refinement hypertext. private static net.nutch.ontology.Ontology ontology; // note: should we ignore plugin exceptions, or rethrow it below? // Rethrowing it effectively prevents the servlet class from // being loaded into the JVM. Need improvement in future. static { try { String urls = net.nutch.util.NutchConf.get("extension.ontology.urls"); ontology = net.nutch.ontology.OntologyFactory.getOntology(); if (urls==null || urls.trim().equals("")) { // ignored siliently } else { ontology.load(urls.split("\\s+")); } } catch (Exception e) { // ignored siliently } }; %> Index: search.jsp =================================================================== RCS file: /cvsroot/nutch/nutch/src/web/jsp/search.jsp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** search.jsp 3 Oct 2004 22:23:31 -0000 1.31 --- search.jsp 30 Nov 2004 06:36:03 -0000 1.32 *************** *** 43,47 **** } ! %><% NutchBean bean = NutchBean.get(application); // set the character encoding to use when interpreting request values --- 43,55 ---- } ! %> ! ! <%-- ! // Uncomment this to enable query refinement. ! // Do the same to "refine-query.jsp" below. ! <%@ include file="./refine-query-init.jsp" %> ! --%> ! ! <% NutchBean bean = NutchBean.get(application); // set the character encoding to use when interpreting request values *************** *** 122,125 **** --- 130,140 ---- <% } %> </form> + + <%-- + // Uncomment this to enable query refinement. + // Do the same to "refine-query-init.jsp" above. + <%@ include file="./refine-query.jsp" %> + --%> + <% // how many hits to retrieve? if clustering is on and available, ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ Nutch-cvs mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nutch-cvs