You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Parvin Gasimzade <pa...@gmail.com> on 2011/12/28 08:16:54 UTC

Custom Solr FunctionQuery Error

Hi all,

I have created custom Solr FunctionQuery in Solr 3.4.
I extended ValueSourceParser, ValueSource, Query and QParserPlugin classes.

I set the name parameter as "graph" inside GraphQParserPlugin class.

But when try to search i got an error. Search queries are

http://localhost:8080/solr/select/?q={!graph}test<http://localhost:8080/recomm/select/?q=%7B!graph%7Dtest>
http://localhost:8080/solr/select/?q=test&defType=graph<http://localhost:8080/recomm/select/?q=test&defType=graph>

I also add the *<valueSourceParser name="graph"
class="org.gasimzade.solr.GraphValueSourceParser"/> *into
solrConfig.xml but i got the same error...

Error message is :

Dec 27, 2011 7:05:20 PM org.apache.solr.common.SolrException log
SEVERE: org.apache.solr.common.SolrException: Unknown query type 'graph'
 at org.apache.solr.core.SolrCore.getQueryPlugin(SolrCore.java:1517)
at org.apache.solr.search.QParser.getParser(QParser.java:316)
 at
org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:80)
at
org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:173)
 at
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1368)
 at
org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:356)
at
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:252)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
 at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
 at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:185)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
 at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:151)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
 at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
 at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:269)
 at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300)
 at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
 at java.lang.Thread.run(Thread.java:679)

Thank you for your help.

Best Regards,
Parvin

Re: Custom Solr FunctionQuery Error

Posted by Juan Grande <ju...@gmail.com>.
Hi Parvin,

You must also add the query parser definition to solrconfig.xml, for
example:

<queryParser name="graph" class="org.gasimzade.solr.GraphQParserPlugin"/>

*Juan*



On Wed, Dec 28, 2011 at 4:16 AM, Parvin Gasimzade <
parvin.gasimzade@gmail.com> wrote:

> Hi all,
>
> I have created custom Solr FunctionQuery in Solr 3.4.
> I extended ValueSourceParser, ValueSource, Query and QParserPlugin classes.
>
> I set the name parameter as "graph" inside GraphQParserPlugin class.
>
> But when try to search i got an error. Search queries are
>
> http://localhost:8080/solr/select/?q={!graph}test<
> http://localhost:8080/recomm/select/?q=%7B!graph%7Dtest<http://localhost:8080/recomm/select/?q=%7B%21graph%7Dtest>
> >
> http://localhost:8080/solr/select/?q=test&defType=graph<
> http://localhost:8080/recomm/select/?q=test&defType=graph>
>
> I also add the *<valueSourceParser name="graph"
> class="org.gasimzade.solr.GraphValueSourceParser"/> *into
> solrConfig.xml but i got the same error...
>
> Error message is :
>
> Dec 27, 2011 7:05:20 PM org.apache.solr.common.SolrException log
> SEVERE: org.apache.solr.common.SolrException: Unknown query type 'graph'
>  at org.apache.solr.core.SolrCore.getQueryPlugin(SolrCore.java:1517)
> at org.apache.solr.search.QParser.getParser(QParser.java:316)
>  at
>
> org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:80)
> at
>
> org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:173)
>  at
>
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
> at org.apache.solr.core.SolrCore.execute(SolrCore.java:1368)
>  at
>
> org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:356)
> at
>
> org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:252)
>  at
>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
> at
>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>  at
>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
>  at
>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
> at
>
> org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
>  at
>
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
> at
>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
>  at
>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
> at
>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
>  at
>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:185)
> at
>
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
>  at
>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:151)
> at
>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
>  at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
> at
>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>  at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:269)
>  at
>
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
> at
>
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300)
>  at
>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
> at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>  at java.lang.Thread.run(Thread.java:679)
>
> Thank you for your help.
>
> Best Regards,
> Parvin
>

Re: Custom Solr FunctionQuery Error

Posted by Á_____o <ch...@yahoo.es>.
Hi!

Although more than 1 year has passed, could I ask you, Parvin, what was your
final approach?

I have to deal with a similar problem
(http://lucene.472066.n3.nabble.com/Combining-Solr-score-with-customized-user-ratings-for-a-document-td4040200.html),
maybe a bit more difficult because it's a by-user score customization, but I
would probably find helpful your solution.

Thanks!
Álvaro



--
View this message in context: http://lucene.472066.n3.nabble.com/Custom-Solr-FunctionQuery-Error-tp3615899p4041113.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Custom Solr FunctionQuery Error

Posted by Parvin Gasimzade <pa...@gmail.com>.
Thank you for your answers.

I have a Map<docId, score> and want to boost the score of that documents
during search time.

In my example i get that map inside ValueSource and boost the matched
documents score.

In the query if {!graph} is added then it will return boosted query
otherwise it will return regular list.

For this design , which classes should i extend? Or how can i solve that
issue?

Regards,
Parvin

On Thu, Dec 29, 2011 at 1:07 AM, Yonik Seeley <yo...@lucidimagination.com>wrote:

> On Wed, Dec 28, 2011 at 2:16 AM, Parvin Gasimzade
> <pa...@gmail.com> wrote:
> > I have created custom Solr FunctionQuery in Solr 3.4.
> > I extended ValueSourceParser, ValueSource, Query and QParserPlugin
> classes.
>
> Note that you only need a QParserPlugin implementation for top level
> query types, not function queries.
> With just a ValueSourceParser and ValueSource implementation, you can
> use the custom function as a function query.
>
> Example:
> q={!func}graph("myparameter")
>
> -Yonik
> http://www.lucidimagination.com
>

Re: Custom Solr FunctionQuery Error

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Wed, Dec 28, 2011 at 2:16 AM, Parvin Gasimzade
<pa...@gmail.com> wrote:
> I have created custom Solr FunctionQuery in Solr 3.4.
> I extended ValueSourceParser, ValueSource, Query and QParserPlugin classes.

Note that you only need a QParserPlugin implementation for top level
query types, not function queries.
With just a ValueSourceParser and ValueSource implementation, you can
use the custom function as a function query.

Example:
q={!func}graph("myparameter")

-Yonik
http://www.lucidimagination.com