OK, So thats why I cannot see the FunctionQuery fields in my SearchComponent class. So then question would be how can I apply my custom processing/logic to these FunctionQuery ? Whats the ExtensionPoint in Solr for such scenarios ?
Basically I want to call termfreq() for each document and then apply the sum to all doc's termfreq() results and show in one aggregated TermFreq field in my query response. Thanks. Tony On Tue, Jul 16, 2013 at 6:01 PM, Jack Krupansky <j...@basetechnology.com>wrote: > Basically, the evaluation of function queries in the "fl" parameter occurs > when the response writer is composing the document results. That's AFTER > all of the search components are done. > > SolrReturnFields.**getTransformer() gets the DocTransformer, which is > really a DocTransformers, and then a call to DocTransformers.transform() in > each response writer will evaluate the embedded function queries and insert > their values in the results as they are being written. > > -- Jack Krupansky > > -----Original Message----- From: Tony Mullins > Sent: Tuesday, July 16, 2013 1:37 AM > To: solr-user@lucene.apache.org > Subject: Re: Doc's FunctionQuery result field in my custom SearchComponent > class ? > > > No sorry, I am still not getting the termfreq() field in my 'doc' object. > I do get the _version_ field in my 'doc' object which I think is > realValue=StoredField. > > At which point termfreq() or any other FunctionQuery field becomes the part > of doc object in Solr ? And at that point can I perform some custom logic > and append the response ? > > Thanks. > Tony > > > > > > On Tue, Jul 16, 2013 at 1:34 AM, Patanachai Tangchaisin < > patanachai.tangchaisin@**wizecommerce.com<patanachai.tangchai...@wizecommerce.com>> > wrote: > > Hi, >> >> I think the process of retrieving a stored field (through fl) is happens >> after SearchComponent. >> >> One solution: If you wrap a q params with function your score will be a >> result of the function. >> For example, >> >> http://localhost:8080/solr/****collection2/demoendpoint?q=**<http://localhost:8080/solr/**collection2/demoendpoint?q=**> >> termfreq%28product,%27spider%****27%29&wt=xml&indent=true&fl=***,**score< >> http://localhost:**8080/solr/collection2/**demoendpoint?q=termfreq%** >> 28product,%27spider%27%29&wt=**xml&indent=true&fl=*,score<http://localhost:8080/solr/collection2/demoendpoint?q=termfreq%28product,%27spider%27%29&wt=xml&indent=true&fl=*,score> >> > >> >> >> >> Now your score is going to be a result of termfreq(product,'spider') >> >> >> -- >> Patanachai Tangchaisin >> >> >> >> On 07/15/2013 12:01 PM, Tony Mullins wrote: >> >> any help plz !!! >>> >>> >>> On Mon, Jul 15, 2013 at 4:13 PM, Tony Mullins <tonymullins...@gmail.com >>> >* >>> *wrote: >>> >>> >>> Please any help on how to get the value of 'freq' field in my custom >>> >>>> SearchComponent ? >>>> >>>> >>>> http://localhost:8080/solr/****collection2/demoendpoint?q=**<http://localhost:8080/solr/**collection2/demoendpoint?q=**> >>>> spider&wt=xml&indent=true&fl=*****,freq:termfreq%28product,%** >>>> 27spider%27%29<http://**localhost:8080/solr/** >>>> collection2/demoendpoint?q=**spider&wt=xml&indent=true&fl=*** >>>> ,freq:termfreq%28product,%**27spider%27%29<http://localhost:8080/solr/collection2/demoendpoint?q=spider&wt=xml&indent=true&fl=*,freq:termfreq%28product,%27spider%27%29> >>>> > >>>> >>>> >>>> <doc><str name="id">11</str><str name="type">Video Games</str><str >>>> name="format">xbox 360</str><str name="product">The Amazing >>>> Spider-Man</str><int name="popularity">11</int><****long >>>> name="_version_">****1439994081345273856</long><int >>>> >>>> name="freq">1</int></doc> >>>> >>>> >>>> >>>> Here is my code >>>> >>>> DocList docs = rb.getResults().docList; >>>> DocIterator iterator = docs.iterator(); >>>> int sumFreq = 0; >>>> String id = null; >>>> >>>> for (int i = 0; i < docs.size(); i++) { >>>> try { >>>> int docId = iterator.nextDoc(); >>>> >>>> // Document doc = searcher.doc(docId, fieldSet); >>>> Document doc = searcher.doc(docId); >>>> >>>> In doc object I can see the schema fields like 'id', 'type','format' >>>> etc. >>>> but I cannot find the field 'freq' which I needed. Is there any way to >>>> get >>>> the FunctionQuery fields in doc object ? >>>> >>>> Thanks, >>>> Tony >>>> >>>> >>>> >>>> On Mon, Jul 15, 2013 at 1:16 PM, Tony Mullins <tonymullins...@gmail.com >>>> > >>>> **wrote: >>>> >>>> Hi, >>>> >>>>> >>>>> I have extended Solr's SearchComonent class and I am iterating through >>>>> all the docs in ResponseBuilder in @overrider Process() method. >>>>> >>>>> Here I want to get the value of FucntionQuery result but in Document >>>>> object I am only seeing the standard field of document not the >>>>> FucntionQuery result. >>>>> >>>>> This is my query >>>>> >>>>> >>>>> http://localhost:8080/solr/****collection2/demoendpoint?q=**<http://localhost:8080/solr/**collection2/demoendpoint?q=**> >>>>> spider&wt=xml&indent=true&fl=*****,freq:termfreq%28product,%** >>>>> 27spider%27%29<http://**localhost:8080/solr/** >>>>> collection2/demoendpoint?q=**spider&wt=xml&indent=true&fl=*** >>>>> ,freq:termfreq%28product,%**27spider%27%29<http://localhost:8080/solr/collection2/demoendpoint?q=spider&wt=xml&indent=true&fl=*,freq:termfreq%28product,%27spider%27%29> >>>>> > >>>>> >>>>> >>>>> Result of above query in browser shows me that 'freq' is part of <doc> >>>>> but its not there in Document object in my @overrider Process() method. >>>>> >>>>> How can I get the value of FunctionQuery result in my custom >>>>> SearchComponent ? >>>>> >>>>> Thanks, >>>>> Tony >>>>> >>>>> >>>>> >>>> >> CONFIDENTIALITY NOTICE >> ====================== >> This email message and any attachments are for the exclusive use of the >> intended recipient(s) and may contain confidential and privileged >> information. Any unauthorized review, use, disclosure or distribution is >> prohibited. If you are not the intended recipient, please contact the >> sender by reply email and destroy all copies of the original message along >> with any attachments, from your computer system. If you are the intended >> recipient, please be advised that the content of this message is subject >> to >> access, review and disclosure by the sender's Email System Administrator. >> >> >> >