I'm not sure i understand your question - largely because you've only 
provided a small sample of information aboutwhat you are doing, and not 
giving a full picture.

what are you actually trying to accomplish?  
With your custom ValueSourceParser, what input are you sending to solr 
that generates that error?  
what does your "DateFunction" do?

Best i can tell from the information provided, you've registered your 
DateSourceParser using the name 'dateDeboost' (just a guess, you never 
actaully said) and then you tried using it in a request in 
some way (boost function?) as 'dateDeboost()' (just guessing based on the 
error message)

In which case this error is entirely expected, because your parse 
implementation says that you expect your function to be passed as input 
another vlaue source -- but when you called your function (in the input 
string 'dateDeboost()') you didn't specify any arguments at all - let 
alone an input argument that could be evaluated as a nested ValueSource.




: Date: Mon, 25 Nov 2013 02:11:43 -0800 (PST)
: From: sling <sling...@gmail.com>
: Reply-To: solr-user@lucene.apache.org
: To: solr-user@lucene.apache.org
: Subject: In a functon query,
:     I can't get the ValueSource when extend ValueSourceParser
: 
: hi,
: I am working with solr4.1.
: When I don't parseValueSource, my function query works well. The code is
: like this:
: public class DateSourceParser extends ValueSourceParser {
:       @Override
:       public void init(NamedList namedList) {
:       }
:       @Override
:       *public ValueSource parse(FunctionQParser fp) throws SyntaxError {      
        
:               return new DateFunction();
:       }*
: }
: 
: When I want to use the ValueSource, like this:
: public class DateSourceParser extends ValueSourceParser {
:       @Override
:       public void init(NamedList namedList) {
:       }
:       @Override
:       *public ValueSource parse(FunctionQParser fp) throws SyntaxError {
:               ValueSource source = fp.parseValueSource();
:               return new DateFunction(source);
:       }*
: }
: 
: fp.parseValueSource() throws an error like this:
: ERROR [org.apache.solr.core.SolrCore] -
: org.apache.solr.common.SolrException: org.apache.solr.search.SyntaxError:
: Expected identifier at pos 12 str='dateDeboost()'
:         at
: 
org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:147)
:         at
: 
org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:187)
:         at
: 
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
:         at org.apache.solr.core.SolrCore.execute(SolrCore.java:1816)
:         at
: 
org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:448)
:         at
: 
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:269)
:         at
: 
com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
:         at
: 
com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:173)
:         at
: 
com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
:         at
: com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:274)
:         at com.caucho.server.port.TcpConnection.run(TcpConnection.java:514)
:         at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:527)
:         at com.caucho.util.ThreadPool.run(ThreadPool.java:449)
:         at java.lang.Thread.run(Thread.java:662)
: Caused by: org.apache.solr.search.SyntaxError: Expected identifier at pos 12
: str='dateDeboost()'
:         at
: org.apache.solr.search.QueryParsing$StrParser.getId(QueryParsing.java:747)
:         at
: org.apache.solr.search.QueryParsing$StrParser.getId(QueryParsing.java:726)
:         at
: 
org.apache.solr.search.FunctionQParser.parseValueSource(FunctionQParser.java:345)
:         at
: 
org.apache.solr.search.FunctionQParser.parseValueSource(FunctionQParser.java:223)
:         at
: org.sling.solr.custom.DateSourceParser.parse(DateSourceParser.java:24)
:         at
: 
org.apache.solr.search.FunctionQParser.parseValueSource(FunctionQParser.java:352)
:         at
: org.apache.solr.search.FunctionQParser.parse(FunctionQParser.java:68)
:         at org.apache.solr.search.QParser.getQuery(QParser.java:142)
:         at
: org.apache.solr.search.BoostQParserPlugin$1.parse(BoostQParserPlugin.java:61)
:         at org.apache.solr.search.QParser.getQuery(QParser.java:142)
:         at
: 
org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:117)
:         ... 13 more
: 
: 
: so, how to make fp.parseValueSource() work?
: 
: Thanks!!!
: 
: sling
: 
: 
: 
: 
: 
: --
: View this message in context: 
http://lucene.472066.n3.nabble.com/In-a-functon-query-I-can-t-get-the-ValueSource-when-extend-ValueSourceParser-tp4103026.html
: Sent from the Solr - User mailing list archive at Nabble.com.
: 

-Hoss

Reply via email to