Maya - where’s the variable come from? You can compute a “pseudo-field”, something like this:
$ bin/solr create -c test $ bin/post -c test -type text/csv -out yes -d $'id,type,price_td\n1,Toys,55.00’ $ open http://localhost:8983/solr/test/select?q=*:*&wt=xml&fl=id,type,price_td,sale_price:product(price_td,0.9) Note that I used price_td, otherwise the field type guessing will make it multivalued and not suitable for functions like that. Does that help? Or maybe you’re interested in something like Solr’s ExternalFileField? — Erik Hatcher, Senior Solutions Architect http://www.lucidworks.com > On Jul 8, 2015, at 2:03 PM, Maya G <maiki...@gmail.com> wrote: > > Hello, > > I'm using solr 4.10. > I'd like to know if it is possible to add a field only on query response and > calculate its' value for the specific query. > > For example: > Assume this is the document. > <doc> > <Id>1</Id> > <Type>Toys</Type> > <Price>55</Price> > </doc> > > I would like the response to contain another field which its' value to be > calculates from the value of 'price' and a given variable. > The field's value can be change from query to query and shouldn't be > indexed. > > Is it possible to run a query and create a new field 'price_sale' on > runtime? > > Thanks in advance, > Maya > Is there a way to do this on solr? > > > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/Adding-field-to-query-result-tp4216396.html > Sent from the Solr - User mailing list archive at Nabble.com.