Re: Add a new field dynamically to each of the result docs and sort on it

2016-06-01 Thread Mark Robinson
Thanks Charlie! I will check this and try it out. Best, Mark. On Wed, Jun 1, 2016 at 7:00 AM, Charlie Hull wrote: > On 01/06/2016 11:56, Mark Robinson wrote: > >> Just to complete my prev use case, in case no direct way is possible in >> SOLR to sort on a field in a

Re: Add a new field dynamically to each of the result docs and sort on it

2016-06-01 Thread Mark Robinson
Thanks for the reply Hoss! Let me do a quick explanation to the sort by tagValue. (Actually I quickly added this part in a different mail when I found I missed it in this mail..) That is where the dynamic input parameter comes in. The input will specify for which local outlet (outlet id passed)

Re: Add a new field dynamically to each of the result docs and sort on it

2016-06-01 Thread Chris Hostetter
: Let me try to detail. : We have our "product" core with a couple of million docs. : We have a couple of thousand outlets where the products get sold. : Each product can have a different *tagValue* in each outlet. : Our "product_tag" core (around 2M times 2000 records), captures tag info of :

Re: Add a new field dynamically to each of the result docs and sort on it

2016-06-01 Thread Charlie Hull
On 01/06/2016 11:56, Mark Robinson wrote: Just to complete my prev use case, in case no direct way is possible in SOLR to sort on a field in a different core, is there a way to embed the tagValue of a product dynamically into the results (the storeid will be passed at query time. So query the

Re: Add a new field dynamically to each of the result docs and sort on it

2016-06-01 Thread Mark Robinson
Just to complete my prev use case, in case no direct way is possible in SOLR to sort on a field in a different core, is there a way to embed the tagValue of a product dynamically into the results (the storeid will be passed at query time. So query the product_tags core for that product+storeid and

Re: Add a new field dynamically to each of the result docs and sort on it

2016-06-01 Thread Mark Robinson
Thanks much Eric and Hoss! Let me try to detail. We have our "product" core with a couple of million docs. We have a couple of thousand outlets where the products get sold. Each product can have a different *tagValue* in each outlet. Our "product_tag" core (around 2M times 2000 records), captures

Re: Add a new field dynamically to each of the result docs and sort on it

2016-05-31 Thread Chris Hostetter
: When a query comes in, I want to populate value for this field in the : results based on some values passed in the query. : So what needs to be accommodated in the result depends on a parameter in : the query and I would like to sort the final results on this field also, : which is dynamically

Re: Add a new field dynamically to each of the result docs and sort on it

2016-05-31 Thread Erick Erickson
To have Lucene/Solr do the sorting, your value must be in the docs at search time. Consider the clause "=my_field asc". If rows=10, then only the top 10 docs are kept. So if a doc's score is non-zero, it's value is compared against the 10 docs in the list and either replaces one or is discarded.

Re: Add a new field dynamically to each of the result docs and sort on it

2016-05-31 Thread Shawn Heisey
On 5/31/2016 10:16 AM, Mark Robinson wrote: > sorry Eric... I did not phrase it right ... what I meant was the field is > there in the schema, but I do not have values for it when normal indexing > happens. > When a query comes in, I want to populate value for this field in the > results based on

Re: Add a new field dynamically to each of the result docs and sort on it

2016-05-31 Thread Mark Robinson
sorry Eric... I did not phrase it right ... what I meant was the field is there in the schema, but I do not have values for it when normal indexing happens. When a query comes in, I want to populate value for this field in the results based on some values passed in the query. So what needs to be

Re: Add a new field dynamically to each of the result docs and sort on it

2016-05-31 Thread Erick Erickson
I really don't understand this. If you don't have "fieldnew", where is the value coming from? It's not in the index so If you mean you're _adding_ a field after the index already has some docs in it, then the normal sort rules apply and you can specify sortMisingFirst/Last to tell Solr where