You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@nutch.apache.org by "Kevin.Y" <02...@163.com> on 2007/10/09 20:57:25 UTC
ClassCastException thrown while doing range search
Hi all , I get a problem about range search.
In order to make Nutch to do range search , i implemented a query filter
plugin following this example:
http://svn.apache.org/viewvc/lucene/nutch/trunk/src/plugin/query-more/src/java/org/apache/nutch/searcher/more/DateQueryFilter.java?view=markup&pathrev=179640
But when i got the plugin ready and then run a range search , it thrown a
ClassCastException , which was recorded in %TOMCAT%/logs/stdout_20071009.log
. Here is the details :
========================
....
2007-10-09 09:17:35,812 ERROR [jsp] - Servlet.service() for servlet jsp
threw exception
java.lang.ClassCastException: org.apache.nutch.searcher.Query$Phrase
at org.apache.nutch.searcher.Query$Clause.getTerm(Query.java:97)
at com.mysite.searcher.QueryMyRange.filter(QueryMyRange.java:44) //
"QueryMyRange.java"
at org.apache.nutch.searcher.QueryFilters.filter(QueryFilters.java:109)
at org.apache.nutch.searcher.IndexSearcher.search(IndexSearcher.java:94)
at org.apache.nutch.searcher.NutchBean.search(NutchBean.java:181)
at org.apache.nutch.searcher.NutchBean.search(NutchBean.java:243)
at org.apache.jsp.rent_jsp._jspService(rent_jsp.java:387)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)
..........
===========================
It seems the exception is thrown from line 44 of "QueryMyRange.java" ,which
is my DIY query filter.
The code is :
[code]
......
44 String x = c.getTerm().toString()
......
[/code]
Anybody tell me why and how to handle it ? Any reply will be appreciate!
Regards
Kevin
--
View this message in context: http://www.nabble.com/ClassCastException-thrown-while-doing-range-search-tf4596235.html#a13122317
Sent from the Nutch - User mailing list archive at Nabble.com.
Re: ClassCastException thrown while doing range search
Posted by "Kevin.Y" <02...@163.com>.
I have found out the reason.
To do a range search against a field , the field must be defined as
"raw-fields" , NOT "fields". That means the plugin.xml of the
range-query-plugin should look like this :
......
<parameter name="raw-fields" value="fieldname"/>
......
If set it to "fields" instead of "raw-fields", a ClassCastException will be
thrown. It seems only "raw-fields" can be searched by range.
Now I can run range search successfully. Hope my experience can help the one
who get the same problem.
Regards
Kevin
--
View this message in context: http://www.nabble.com/ClassCastException-thrown-while-doing-range-search-tf4596235.html#a13172322
Sent from the Nutch - User mailing list archive at Nabble.com.