FW: howto: get the value from a multivalued field?

2013-05-23 Thread world hello




hi, all - 
how can I retrieve the value out of a multivalued field in a customized 
function query?I want to implement a function query whose first parameter is a 
multi-value fileld, from which values are retrieved and manipulated. 
however, I used the code but get exceptions - can not use FieldCache on 
multivalued field
/public ValueSource parse(FunctionQParser fp) 
throws ParseException {
try { ValueSource vs = fp.parseValueSource();   }   
catch (...)   {   }
Thanks.
- Frank


  

Re: howto: get the value from a multivalued field?

2013-05-23 Thread Jack Krupansky
Yeah, you can't do that. You'll need to keep a copy of whichever value from 
the multi-valued field you wish to be considered the value in a separate, 
non-multi-valued field. Possibly using an update processor, such as one of:


FirstFieldValueUpdateProcessorFactory, LastFieldValueUpdateProcessorFactory, 
MaxFieldValueUpdateProcessorFactory, MinFieldValueUpdateProcessorFactory


-- Jack Krupansky

-Original Message- 
From: world hello

Sent: Thursday, May 23, 2013 7:50 PM
To: solr-user@lucene.apache.org
Subject: FW: howto: get the value from a multivalued field?





hi, all -
how can I retrieve the value out of a multivalued field in a customized 
function query?I want to implement a function query whose first parameter is 
a multi-value fileld, from which values are retrieved and manipulated.
however, I used the code but get exceptions - can not use FieldCache on 
multivalued field
/public ValueSource parse(FunctionQParser fp) 
throws ParseException {
   try { ValueSource vs = fp.parseValueSource();   } 
catch (...)   {   }

Thanks.
- Frank





RE: howto: get the value from a multivalued field?

2013-05-23 Thread world hello
thanks, jack. 
could you please  give more details on using update processor?
Thanks.
- frank

 From: j...@basetechnology.com
 To: solr-user@lucene.apache.org
 Subject: Re: howto: get the value from a multivalued field?
 Date: Thu, 23 May 2013 20:06:34 -0400
 
 Yeah, you can't do that. You'll need to keep a copy of whichever value from 
 the multi-valued field you wish to be considered the value in a separate, 
 non-multi-valued field. Possibly using an update processor, such as one of:
 
 FirstFieldValueUpdateProcessorFactory, LastFieldValueUpdateProcessorFactory, 
 MaxFieldValueUpdateProcessorFactory, MinFieldValueUpdateProcessorFactory
 
 -- Jack Krupansky
 
 -Original Message- 
 From: world hello
 Sent: Thursday, May 23, 2013 7:50 PM
 To: solr-user@lucene.apache.org
 Subject: FW: howto: get the value from a multivalued field?
 
 
 
 
 
 hi, all -
 how can I retrieve the value out of a multivalued field in a customized 
 function query?I want to implement a function query whose first parameter is 
 a multi-value fileld, from which values are retrieved and manipulated.
 however, I used the code but get exceptions - can not use FieldCache on 
 multivalued field
 /public ValueSource parse(FunctionQParser fp) 
 throws ParseException {
 try { ValueSource vs = fp.parseValueSource();   } 
 catch (...)   {   }
 Thanks.
 - Frank