You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Walter Underwood <wu...@wunderwood.org> on 2017/02/28 00:17:02 UTC

Using parameter values in a sort

We have documents with parameterized features. For a school subject (calculus, accounting), we have three sets of features. So for subject=4 and subject=186, we have:

feature_a_4: 0.9
feature_b_4: 1.6
feature_c_4: 8.2
feature_a_186: 3.0
feature_b_186: 2.1
feature_c_186: 99.2

I’d like to pass in the subject IDs and make a function query (for sorting) from those, ending up with

sum(feature_x, feature_y, feature_a_4, feature_b_4, feature_c_4, feature_a_186, feature_b_186, feature c_186) desc

That would be used for the sort parameter.

Failing that, it would be nice so just pass in the parameterized portion, like this:

/handler?features=feature_a_4,feature_b_4,feature_c_4,feature_a_186,feature_b_186,feature c_186

Right now, I can’t even make a solrconfig.xml that will load. I’ve read everything I can find on params and function queries.

wunder
Walter Underwood
wunder@wunderwood.org
http://observer.wunderwood.org/  (my blog)



Re: Using parameter values in a sort

Posted by Erick Erickson <er...@gmail.com>.
Hmm, the syntax can be tricky. I'd start with a vanilla solrconfig.xml and
get the syntax right just with curl or the browser, _then_ go to
trying to embed it in solrconfig.xml.

What error are you getting anyway?

Erick

On Mon, Feb 27, 2017 at 4:17 PM, Walter Underwood <wu...@wunderwood.org> wrote:
> We have documents with parameterized features. For a school subject (calculus, accounting), we have three sets of features. So for subject=4 and subject=186, we have:
>
> feature_a_4: 0.9
> feature_b_4: 1.6
> feature_c_4: 8.2
> feature_a_186: 3.0
> feature_b_186: 2.1
> feature_c_186: 99.2
>
> I’d like to pass in the subject IDs and make a function query (for sorting) from those, ending up with
>
> sum(feature_x, feature_y, feature_a_4, feature_b_4, feature_c_4, feature_a_186, feature_b_186, feature c_186) desc
>
> That would be used for the sort parameter.
>
> Failing that, it would be nice so just pass in the parameterized portion, like this:
>
> /handler?features=feature_a_4,feature_b_4,feature_c_4,feature_a_186,feature_b_186,feature c_186
>
> Right now, I can’t even make a solrconfig.xml that will load. I’ve read everything I can find on params and function queries.
>
> wunder
> Walter Underwood
> wunder@wunderwood.org
> http://observer.wunderwood.org/  (my blog)
>
>

Re: Using parameter values in a sort

Posted by Erik Hatcher <er...@gmail.com>.
And by turning off parameter substitutions I meant disable `expandMacros` - https://cwiki.apache.org/confluence/display/solr/Parameter+Substitution <https://cwiki.apache.org/confluence/display/solr/Parameter+Substitution>

Likely you haven’t and this feature should work.   I’d remove `scores` from your config (unless you’re going to provide a valid default, by maybe moving where  you put “desc” in the parameters) and provide that as a mandatory (or optional depending on how you arrange the params, possibly) `scores` param.


   /select?q=*:*&scores=feature_a_1,feature_b_2
     &sort=sum(${scores}) desc




> On Feb 27, 2017, at 9:35 PM, Erik Hatcher <er...@gmail.com> wrote:
> 
> You have an empty “scores” parameter in there.  You’re not showing your full search request, but did you provide that in the request?   Have you perhaps turned off parameter substitutions?
> 
> 	Erik
> 
> 
> 
> 
>> On Feb 27, 2017, at 9:26 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>> 
>> With this in the config…
>> 
>> <requestHandler name="/display_tutor_rank" class="solr.SearchHandler">
>>    <!-- Note! Needs FuzzyDismax handler! --> 
>>    <lst name="defaults">
>>      <str name="defType">edismax</str>
>>      <str name="mm">0</str>
>>      <bool name="lowercaseOperators">false</bool>
>>      <str name="fl">id,
>>      image_thumb_large, image_thumb_medium, image_thumb_small,
>>      image_thumb_xlarge, uri, user_id, last_name, first_name,
>>      name, school, major, graduation_year, tutor_profile_id,
>>      positive_reviews, negative_reviews, gender, about_experience,
>>      about_extracurricular, time_approved</str>
>>      <str name="q.alt">*:*</str>
>>      <str name="qf">about_experience  about_extracurricular School  Major</str>
>>      <str name="scores"></str>
>>      <str name="sort">sum(interaction_responsiveness_score,profile_completeness_score,school_score,us_tax_id_score,highlight_score,${scores}) desc</str>
>>      <str name="boost">log(sum(1,max(positive_reviews,0)))</str>
>>      <str name="tie">0.1</str>
>>    </lst>
>> </requestHandler>
>> 
>> I see this… [Solr 6.3.0]
>> 
>> org.apache.solr.common.SolrException: Unable to reload core [tutors_shard1_replica11]
>> 	at org.apache.solr.core.CoreContainer.reload(CoreContainer.java:950)
>> 	at org.apache.solr.core.SolrCore.lambda$getConfListener$6(SolrCore.java:2708)
>> 	at org.apache.solr.cloud.ZkController.lambda$fireEventListeners$4(ZkController.java:2448)
>> 	at java.lang.Thread.run(Thread.java:745)
>> Caused by: org.apache.solr.common.SolrException: Could not load conf for core tutors_shard1_replica11: Error loading solr config from solrconfig.xml
>> 	at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:85)
>> 	at org.apache.solr.core.CoreContainer.reload(CoreContainer.java:942)
>> 	... 3 more
>> Caused by: org.apache.solr.common.SolrException: Error loading solr config from solrconfig.xml
>> 	at org.apache.solr.core.SolrConfig.readFromResourceLoader(SolrConfig.java:187)
>> 	at org.apache.solr.core.ConfigSetService.createSolrConfig(ConfigSetService.java:97)
>> 	at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:77)
>> 	... 4 more
>> Caused by: org.apache.solr.common.SolrException: No system property or default value specified for scores value:sum(interaction_responsiveness_score,profile_completeness_score,school_score,us_tax_id_score,highlight_score,${scores}) desc
>> 	at org.apache.solr.util.PropertiesUtil.substituteProperty(PropertiesUtil.java:65)
>> 	at org.apache.solr.util.DOMUtil.substituteProperties(DOMUtil.java:298)
>> 
>> wunder
>> Walter Underwood
>> wunder@wunderwood.org
>> http://observer.wunderwood.org/  (my blog)
>> 
>> 
>>> On Feb 27, 2017, at 6:17 PM, Erik Hatcher <er...@gmail.com> wrote:
>>> 
>>> Walter -
>>> 
>>> How about this, for the latter part of your request:
>>> 
>>> /handler?features=a,b,c
>>> 
>>>   with &sort=sum(${features}) desc
>>> 
>>> That ought to do the trick.   At first I thought the #foreach nature of the list of features was prohibitive, but since you’re literally plugging in the exact string value and it’s used as a comma-separated list then this should work.
>>> 
>>> But with the just a list of subject ID’s I think you’re in custom development now (or a JavaScript stage in a Fusion query pipeline ;) in building a SearchComponent that takes a `features` parameter and builds the sort param as needed from that.
>>> 
>>> 	Erik
>>> 
>>> 
>>> 
>>>> On Feb 27, 2017, at 7:17 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>>>> 
>>>> We have documents with parameterized features. For a school subject (calculus, accounting), we have three sets of features. So for subject=4 and subject=186, we have:
>>>> 
>>>> feature_a_4: 0.9
>>>> feature_b_4: 1.6
>>>> feature_c_4: 8.2
>>>> feature_a_186: 3.0
>>>> feature_b_186: 2.1
>>>> feature_c_186: 99.2
>>>> 
>>>> I’d like to pass in the subject IDs and make a function query (for sorting) from those, ending up with
>>>> 
>>>> sum(feature_x, feature_y, feature_a_4, feature_b_4, feature_c_4, feature_a_186, feature_b_186, feature c_186) desc
>>>> 
>>>> That would be used for the sort parameter.
>>>> 
>>>> Failing that, it would be nice so just pass in the parameterized portion, like this:
>>>> 
>>>> /handler?features=feature_a_4,feature_b_4,feature_c_4,feature_a_186,feature_b_186,feature c_186
>>>> 
>>>> Right now, I can’t even make a solrconfig.xml that will load. I’ve read everything I can find on params and function queries.
>>>> 
>>>> wunder
>>>> Walter Underwood
>>>> wunder@wunderwood.org
>>>> http://observer.wunderwood.org/  (my blog)
>>>> 
>>>> 
>>> 
>> 
> 


Re: Using parameter values in a sort

Posted by Erik Hatcher <er...@gmail.com>.
> On Feb 27, 2017, at 9:42 PM, Walter Underwood <wu...@wunderwood.org> wrote:
> Pretty ready to give up. The documentation around function queries and params is not working for me, though I’ve been using Solr for ten years. I have figured out a lot of systems. This is impenetrable.

Here’s how I (try to) explain it in Solr training:

    There’s plain uncurly bracketed parameter substitution.  This is where a feature (say local params, or function queries) is designed to indirect an exact parameter and pull it in:

        /select?q=*:*&fq={!terms f=id v=$id_list}&id_list=1,2,3

    And then there’s macro substitution, with curly bracketed syntax, and this is an in place string substitution allowing gluing of things together:

      /select?q=*:*&sort=${sort_field_name} desc&sort_field_name=price

When in doubt, the curly bracketed syntax actually should do the trick, but there’s always the fun aspect of whitespace and escaping and quoting and such, so it is tricky business.   A browser, some trial-and-error, and hopefully some tips and tricks like these that emerge online will be helpful in demystifying this and making it more accessible and useful/usable.

	Erik


Re: Using parameter values in a sort

Posted by Erik Hatcher <er...@gmail.com>.
FYI - I recalled, and located, a solr-user thread from 2015 with subject “Parameter Substitution” with this same issue.   Tricky issue - overloaded `${` usage and interpretation time.

	Erik

> On Mar 1, 2017, at 1:41 PM, Erik Hatcher <er...@gmail.com> wrote:
> 
> I just found a workaround, check out this trick:
> 
>         <str name="sort">${sort_field:${sort_field}} desc</str>
> 
> when the core is loaded, it looks for a system property “sort_field”, doesn’t find it, and defaults the value to ${sort_field} and voila:
> 
>    /browse?q=*:*&wt=xml&sort_field=id
> 
> 	Erik
> 
> 
>> On Mar 1, 2017, at 1:14 PM, Erik Hatcher <er...@gmail.com> wrote:
>> 
>> Walter -
>> 
>> Apologies for not trying this sooner first-hand.   I’m used to passing in all the params (even the dynamic ${…} ones) in the request these days, not so much putting them into request handler definitions.
>> 
>> I finally tried it with a default (master/trunk) with modifying the /browse handler with this:
>> 
>> <requestHandler name="/browse" class="solr.SearchHandler" useParams="query,facets,velocity,browse">
>>   <lst name="defaults">
>>     <str name="echoParams">explicit</str>
>>     <str name="sort">${sort_field} desc</str>
>>   </lst>
>> </requestHandler>
>> 
>> And get this startup error:
>> 
>> Caused by: org.apache.solr.common.SolrException: No system property or default value specified for sort_field value:${sort_field} desc
>> 	at org.apache.solr.util.PropertiesUtil.substituteProperty(PropertiesUtil.java:65)
>> 	at org.apache.solr.util.DOMUtil.substituteProperties(DOMUtil.java:303)
>> 
>> *sigh* and sorry for leading you astray.   Definitely a Solr bug.
>> 
>> However, this technique does work when everything is in the params:
>> 
>>   /select?q=*:*&sort=${sort_field}%20desc&sort_field=id
>> 
>> @Yonik or others - is this a known/filed issue?    Workarounds or escaping that could make it work?
>> 
>> 	Erik
>> 
>> 
>>> On Feb 27, 2017, at 10:39 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>>> 
>>> No, I tried that before adding the default.
>>> 
>>> But the solrconfig.xml is rejected before there is a request, so this is not about requests. I did try “scores” in the requests, but of course it didn’t work because the solrconfig.xml was not loaded. I did not turn off parameter substitutions. This is a pretty vanilla solrconfig.xml.
>>> 
>>> wunder
>>> Walter Underwood
>>> wunder@wunderwood.org
>>> http://observer.wunderwood.org/  (my blog)
>>> 
>>> 
>>>> On Feb 27, 2017, at 6:44 PM, Erik Hatcher <er...@gmail.com> wrote:
>>>> 
>>>> `scores` (plural), you’ve got this below:   <str name="scores"></str>
>>>> 
>>>> Remove that, and like my previous e-mail, and use `scores` (plural) from the request and _should_ work?
>>>> 
>>>> 	Erik
>>>> 
>>>>> On Feb 27, 2017, at 9:42 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>>>>> 
>>>>> I’ve passed in a score parameter, but the solrconfig.xml is rejected before any requests.
>>>>> 
>>>>> Pretty ready to give up. The documentation around function queries and params is not working for me, though I’ve been using Solr for ten years. I have figured out a lot of systems. This is impenetrable.
>>>>> 
>>>>> wunder
>>>>> Walter Underwood
>>>>> wunder@wunderwood.org
>>>>> http://observer.wunderwood.org/  (my blog)
>>>>> 
>>>>> 
>>>>>> On Feb 27, 2017, at 6:35 PM, Erik Hatcher <er...@gmail.com> wrote:
>>>>>> 
>>>>>> You have an empty “scores” parameter in there.  You’re not showing your full search request, but did you provide that in the request?   Have you perhaps turned off parameter substitutions?
>>>>>> 
>>>>>> 	Erik
>>>>>> 
>>>>>>> On Feb 27, 2017, at 9:26 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>>>>>>> 
>>>>>>> With this in the config…
>>>>>>> 
>>>>>>> <requestHandler name="/display_tutor_rank" class="solr.SearchHandler">
>>>>>>> <!-- Note! Needs FuzzyDismax handler! --> 
>>>>>>> <lst name="defaults">
>>>>>>> <str name="defType">edismax</str>
>>>>>>> <str name="mm">0</str>
>>>>>>> <bool name="lowercaseOperators">false</bool>
>>>>>>> <str name="fl">id,
>>>>>>> image_thumb_large, image_thumb_medium, image_thumb_small,
>>>>>>> image_thumb_xlarge, uri, user_id, last_name, first_name,
>>>>>>> name, school, major, graduation_year, tutor_profile_id,
>>>>>>> positive_reviews, negative_reviews, gender, about_experience,
>>>>>>> about_extracurricular, time_approved</str>
>>>>>>> <str name="q.alt">*:*</str>
>>>>>>> <str name="qf">about_experience  about_extracurricular School  Major</str>
>>>>>>> <str name="scores"></str>
>>>>>>> <str name="sort">sum(interaction_responsiveness_score,profile_completeness_score,school_score,us_tax_id_score,highlight_score,${scores}) desc</str>
>>>>>>> <str name="boost">log(sum(1,max(positive_reviews,0)))</str>
>>>>>>> <str name="tie">0.1</str>
>>>>>>> </lst>
>>>>>>> </requestHandler>
>>>>>>> 
>>>>>>> I see this… [Solr 6.3.0]
>>>>>>> 
>>>>>>> org.apache.solr.common.SolrException: Unable to reload core [tutors_shard1_replica11]
>>>>>>> 	at org.apache.solr.core.CoreContainer.reload(CoreContainer.java:950)
>>>>>>> 	at org.apache.solr.core.SolrCore.lambda$getConfListener$6(SolrCore.java:2708)
>>>>>>> 	at org.apache.solr.cloud.ZkController.lambda$fireEventListeners$4(ZkController.java:2448)
>>>>>>> 	at java.lang.Thread.run(Thread.java:745)
>>>>>>> Caused by: org.apache.solr.common.SolrException: Could not load conf for core tutors_shard1_replica11: Error loading solr config from solrconfig.xml
>>>>>>> 	at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:85)
>>>>>>> 	at org.apache.solr.core.CoreContainer.reload(CoreContainer.java:942)
>>>>>>> 	... 3 more
>>>>>>> Caused by: org.apache.solr.common.SolrException: Error loading solr config from solrconfig.xml
>>>>>>> 	at org.apache.solr.core.SolrConfig.readFromResourceLoader(SolrConfig.java:187)
>>>>>>> 	at org.apache.solr.core.ConfigSetService.createSolrConfig(ConfigSetService.java:97)
>>>>>>> 	at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:77)
>>>>>>> 	... 4 more
>>>>>>> Caused by: org.apache.solr.common.SolrException: No system property or default value specified for scores value:sum(interaction_responsiveness_score,profile_completeness_score,school_score,us_tax_id_score,highlight_score,${scores}) desc
>>>>>>> 	at org.apache.solr.util.PropertiesUtil.substituteProperty(PropertiesUtil.java:65)
>>>>>>> 	at org.apache.solr.util.DOMUtil.substituteProperties(DOMUtil.java:298)
>>>>>>> 
>>>>>>> wunder
>>>>>>> Walter Underwood
>>>>>>> wunder@wunderwood.org
>>>>>>> http://observer.wunderwood.org/  (my blog)
>>>>>>> 
>>>>>>> 
>>>>>>>> On Feb 27, 2017, at 6:17 PM, Erik Hatcher <er...@gmail.com> wrote:
>>>>>>>> 
>>>>>>>> Walter -
>>>>>>>> 
>>>>>>>> How about this, for the latter part of your request:
>>>>>>>> 
>>>>>>>> /handler?features=a,b,c
>>>>>>>> 
>>>>>>>> with &sort=sum(${features}) desc
>>>>>>>> 
>>>>>>>> That ought to do the trick.   At first I thought the #foreach nature of the list of features was prohibitive, but since you’re literally plugging in the exact string value and it’s used as a comma-separated list then this should work.
>>>>>>>> 
>>>>>>>> But with the just a list of subject ID’s I think you’re in custom development now (or a JavaScript stage in a Fusion query pipeline ;) in building a SearchComponent that takes a `features` parameter and builds the sort param as needed from that.
>>>>>>>> 
>>>>>>>> 	Erik
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>>> On Feb 27, 2017, at 7:17 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>>>>>>>>> 
>>>>>>>>> We have documents with parameterized features. For a school subject (calculus, accounting), we have three sets of features. So for subject=4 and subject=186, we have:
>>>>>>>>> 
>>>>>>>>> feature_a_4: 0.9
>>>>>>>>> feature_b_4: 1.6
>>>>>>>>> feature_c_4: 8.2
>>>>>>>>> feature_a_186: 3.0
>>>>>>>>> feature_b_186: 2.1
>>>>>>>>> feature_c_186: 99.2
>>>>>>>>> 
>>>>>>>>> I’d like to pass in the subject IDs and make a function query (for sorting) from those, ending up with
>>>>>>>>> 
>>>>>>>>> sum(feature_x, feature_y, feature_a_4, feature_b_4, feature_c_4, feature_a_186, feature_b_186, feature c_186) desc
>>>>>>>>> 
>>>>>>>>> That would be used for the sort parameter.
>>>>>>>>> 
>>>>>>>>> Failing that, it would be nice so just pass in the parameterized portion, like this:
>>>>>>>>> 
>>>>>>>>> /handler?features=feature_a_4,feature_b_4,feature_c_4,feature_a_186,feature_b_186,feature c_186
>>>>>>>>> 
>>>>>>>>> Right now, I can’t even make a solrconfig.xml that will load. I’ve read everything I can find on params and function queries.
>>>>>>>>> 
>>>>>>>>> wunder
>>>>>>>>> Walter Underwood
>>>>>>>>> wunder@wunderwood.org
>>>>>>>>> http://observer.wunderwood.org/  (my blog)
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 
> 


Re: Using parameter values in a sort

Posted by Erik Hatcher <er...@gmail.com>.
I just found a workaround, check out this trick:

         <str name="sort">${sort_field:${sort_field}} desc</str>

when the core is loaded, it looks for a system property “sort_field”, doesn’t find it, and defaults the value to ${sort_field} and voila:

    /browse?q=*:*&wt=xml&sort_field=id

	Erik


> On Mar 1, 2017, at 1:14 PM, Erik Hatcher <er...@gmail.com> wrote:
> 
> Walter -
> 
> Apologies for not trying this sooner first-hand.   I’m used to passing in all the params (even the dynamic ${…} ones) in the request these days, not so much putting them into request handler definitions.
> 
> I finally tried it with a default (master/trunk) with modifying the /browse handler with this:
> 
>  <requestHandler name="/browse" class="solr.SearchHandler" useParams="query,facets,velocity,browse">
>    <lst name="defaults">
>      <str name="echoParams">explicit</str>
>      <str name="sort">${sort_field} desc</str>
>    </lst>
>  </requestHandler>
> 
> And get this startup error:
> 
> Caused by: org.apache.solr.common.SolrException: No system property or default value specified for sort_field value:${sort_field} desc
> 	at org.apache.solr.util.PropertiesUtil.substituteProperty(PropertiesUtil.java:65)
> 	at org.apache.solr.util.DOMUtil.substituteProperties(DOMUtil.java:303)
> 
> *sigh* and sorry for leading you astray.   Definitely a Solr bug.
> 
> However, this technique does work when everything is in the params:
> 
>    /select?q=*:*&sort=${sort_field}%20desc&sort_field=id
> 
> @Yonik or others - is this a known/filed issue?    Workarounds or escaping that could make it work?
> 
> 	Erik
> 
> 
>> On Feb 27, 2017, at 10:39 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>> 
>> No, I tried that before adding the default.
>> 
>> But the solrconfig.xml is rejected before there is a request, so this is not about requests. I did try “scores” in the requests, but of course it didn’t work because the solrconfig.xml was not loaded. I did not turn off parameter substitutions. This is a pretty vanilla solrconfig.xml.
>> 
>> wunder
>> Walter Underwood
>> wunder@wunderwood.org
>> http://observer.wunderwood.org/  (my blog)
>> 
>> 
>>> On Feb 27, 2017, at 6:44 PM, Erik Hatcher <er...@gmail.com> wrote:
>>> 
>>> `scores` (plural), you’ve got this below:   <str name="scores"></str>
>>> 
>>> Remove that, and like my previous e-mail, and use `scores` (plural) from the request and _should_ work?
>>> 
>>> 	Erik
>>> 
>>>> On Feb 27, 2017, at 9:42 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>>>> 
>>>> I’ve passed in a score parameter, but the solrconfig.xml is rejected before any requests.
>>>> 
>>>> Pretty ready to give up. The documentation around function queries and params is not working for me, though I’ve been using Solr for ten years. I have figured out a lot of systems. This is impenetrable.
>>>> 
>>>> wunder
>>>> Walter Underwood
>>>> wunder@wunderwood.org
>>>> http://observer.wunderwood.org/  (my blog)
>>>> 
>>>> 
>>>>> On Feb 27, 2017, at 6:35 PM, Erik Hatcher <er...@gmail.com> wrote:
>>>>> 
>>>>> You have an empty “scores” parameter in there.  You’re not showing your full search request, but did you provide that in the request?   Have you perhaps turned off parameter substitutions?
>>>>> 
>>>>> 	Erik
>>>>> 
>>>>>> On Feb 27, 2017, at 9:26 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>>>>>> 
>>>>>> With this in the config…
>>>>>> 
>>>>>> <requestHandler name="/display_tutor_rank" class="solr.SearchHandler">
>>>>>> <!-- Note! Needs FuzzyDismax handler! --> 
>>>>>> <lst name="defaults">
>>>>>>  <str name="defType">edismax</str>
>>>>>>  <str name="mm">0</str>
>>>>>>  <bool name="lowercaseOperators">false</bool>
>>>>>>  <str name="fl">id,
>>>>>>  image_thumb_large, image_thumb_medium, image_thumb_small,
>>>>>>  image_thumb_xlarge, uri, user_id, last_name, first_name,
>>>>>>  name, school, major, graduation_year, tutor_profile_id,
>>>>>>  positive_reviews, negative_reviews, gender, about_experience,
>>>>>>  about_extracurricular, time_approved</str>
>>>>>>  <str name="q.alt">*:*</str>
>>>>>>  <str name="qf">about_experience  about_extracurricular School  Major</str>
>>>>>>  <str name="scores"></str>
>>>>>>  <str name="sort">sum(interaction_responsiveness_score,profile_completeness_score,school_score,us_tax_id_score,highlight_score,${scores}) desc</str>
>>>>>>  <str name="boost">log(sum(1,max(positive_reviews,0)))</str>
>>>>>>  <str name="tie">0.1</str>
>>>>>> </lst>
>>>>>> </requestHandler>
>>>>>> 
>>>>>> I see this… [Solr 6.3.0]
>>>>>> 
>>>>>> org.apache.solr.common.SolrException: Unable to reload core [tutors_shard1_replica11]
>>>>>> 	at org.apache.solr.core.CoreContainer.reload(CoreContainer.java:950)
>>>>>> 	at org.apache.solr.core.SolrCore.lambda$getConfListener$6(SolrCore.java:2708)
>>>>>> 	at org.apache.solr.cloud.ZkController.lambda$fireEventListeners$4(ZkController.java:2448)
>>>>>> 	at java.lang.Thread.run(Thread.java:745)
>>>>>> Caused by: org.apache.solr.common.SolrException: Could not load conf for core tutors_shard1_replica11: Error loading solr config from solrconfig.xml
>>>>>> 	at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:85)
>>>>>> 	at org.apache.solr.core.CoreContainer.reload(CoreContainer.java:942)
>>>>>> 	... 3 more
>>>>>> Caused by: org.apache.solr.common.SolrException: Error loading solr config from solrconfig.xml
>>>>>> 	at org.apache.solr.core.SolrConfig.readFromResourceLoader(SolrConfig.java:187)
>>>>>> 	at org.apache.solr.core.ConfigSetService.createSolrConfig(ConfigSetService.java:97)
>>>>>> 	at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:77)
>>>>>> 	... 4 more
>>>>>> Caused by: org.apache.solr.common.SolrException: No system property or default value specified for scores value:sum(interaction_responsiveness_score,profile_completeness_score,school_score,us_tax_id_score,highlight_score,${scores}) desc
>>>>>> 	at org.apache.solr.util.PropertiesUtil.substituteProperty(PropertiesUtil.java:65)
>>>>>> 	at org.apache.solr.util.DOMUtil.substituteProperties(DOMUtil.java:298)
>>>>>> 
>>>>>> wunder
>>>>>> Walter Underwood
>>>>>> wunder@wunderwood.org
>>>>>> http://observer.wunderwood.org/  (my blog)
>>>>>> 
>>>>>> 
>>>>>>> On Feb 27, 2017, at 6:17 PM, Erik Hatcher <er...@gmail.com> wrote:
>>>>>>> 
>>>>>>> Walter -
>>>>>>> 
>>>>>>> How about this, for the latter part of your request:
>>>>>>> 
>>>>>>> /handler?features=a,b,c
>>>>>>> 
>>>>>>> with &sort=sum(${features}) desc
>>>>>>> 
>>>>>>> That ought to do the trick.   At first I thought the #foreach nature of the list of features was prohibitive, but since you’re literally plugging in the exact string value and it’s used as a comma-separated list then this should work.
>>>>>>> 
>>>>>>> But with the just a list of subject ID’s I think you’re in custom development now (or a JavaScript stage in a Fusion query pipeline ;) in building a SearchComponent that takes a `features` parameter and builds the sort param as needed from that.
>>>>>>> 
>>>>>>> 	Erik
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>>> On Feb 27, 2017, at 7:17 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>>>>>>>> 
>>>>>>>> We have documents with parameterized features. For a school subject (calculus, accounting), we have three sets of features. So for subject=4 and subject=186, we have:
>>>>>>>> 
>>>>>>>> feature_a_4: 0.9
>>>>>>>> feature_b_4: 1.6
>>>>>>>> feature_c_4: 8.2
>>>>>>>> feature_a_186: 3.0
>>>>>>>> feature_b_186: 2.1
>>>>>>>> feature_c_186: 99.2
>>>>>>>> 
>>>>>>>> I’d like to pass in the subject IDs and make a function query (for sorting) from those, ending up with
>>>>>>>> 
>>>>>>>> sum(feature_x, feature_y, feature_a_4, feature_b_4, feature_c_4, feature_a_186, feature_b_186, feature c_186) desc
>>>>>>>> 
>>>>>>>> That would be used for the sort parameter.
>>>>>>>> 
>>>>>>>> Failing that, it would be nice so just pass in the parameterized portion, like this:
>>>>>>>> 
>>>>>>>> /handler?features=feature_a_4,feature_b_4,feature_c_4,feature_a_186,feature_b_186,feature c_186
>>>>>>>> 
>>>>>>>> Right now, I can’t even make a solrconfig.xml that will load. I’ve read everything I can find on params and function queries.
>>>>>>>> 
>>>>>>>> wunder
>>>>>>>> Walter Underwood
>>>>>>>> wunder@wunderwood.org
>>>>>>>> http://observer.wunderwood.org/  (my blog)
>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 
> 


Re: Using parameter values in a sort

Posted by Erik Hatcher <er...@gmail.com>.
Walter -

Apologies for not trying this sooner first-hand.   I’m used to passing in all the params (even the dynamic ${…} ones) in the request these days, not so much putting them into request handler definitions.

I finally tried it with a default (master/trunk) with modifying the /browse handler with this:

  <requestHandler name="/browse" class="solr.SearchHandler" useParams="query,facets,velocity,browse">
    <lst name="defaults">
      <str name="echoParams">explicit</str>
      <str name="sort">${sort_field} desc</str>
    </lst>
  </requestHandler>

And get this startup error:

Caused by: org.apache.solr.common.SolrException: No system property or default value specified for sort_field value:${sort_field} desc
	at org.apache.solr.util.PropertiesUtil.substituteProperty(PropertiesUtil.java:65)
	at org.apache.solr.util.DOMUtil.substituteProperties(DOMUtil.java:303)

*sigh* and sorry for leading you astray.   Definitely a Solr bug.

However, this technique does work when everything is in the params:

    /select?q=*:*&sort=${sort_field}%20desc&sort_field=id

@Yonik or others - is this a known/filed issue?    Workarounds or escaping that could make it work?

	Erik


> On Feb 27, 2017, at 10:39 PM, Walter Underwood <wu...@wunderwood.org> wrote:
> 
> No, I tried that before adding the default.
> 
> But the solrconfig.xml is rejected before there is a request, so this is not about requests. I did try “scores” in the requests, but of course it didn’t work because the solrconfig.xml was not loaded. I did not turn off parameter substitutions. This is a pretty vanilla solrconfig.xml.
> 
> wunder
> Walter Underwood
> wunder@wunderwood.org
> http://observer.wunderwood.org/  (my blog)
> 
> 
>> On Feb 27, 2017, at 6:44 PM, Erik Hatcher <er...@gmail.com> wrote:
>> 
>> `scores` (plural), you’ve got this below:   <str name="scores"></str>
>> 
>> Remove that, and like my previous e-mail, and use `scores` (plural) from the request and _should_ work?
>> 
>> 	Erik
>> 
>>> On Feb 27, 2017, at 9:42 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>>> 
>>> I’ve passed in a score parameter, but the solrconfig.xml is rejected before any requests.
>>> 
>>> Pretty ready to give up. The documentation around function queries and params is not working for me, though I’ve been using Solr for ten years. I have figured out a lot of systems. This is impenetrable.
>>> 
>>> wunder
>>> Walter Underwood
>>> wunder@wunderwood.org
>>> http://observer.wunderwood.org/  (my blog)
>>> 
>>> 
>>>> On Feb 27, 2017, at 6:35 PM, Erik Hatcher <er...@gmail.com> wrote:
>>>> 
>>>> You have an empty “scores” parameter in there.  You’re not showing your full search request, but did you provide that in the request?   Have you perhaps turned off parameter substitutions?
>>>> 
>>>> 	Erik
>>>> 
>>>>> On Feb 27, 2017, at 9:26 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>>>>> 
>>>>> With this in the config…
>>>>> 
>>>>> <requestHandler name="/display_tutor_rank" class="solr.SearchHandler">
>>>>> <!-- Note! Needs FuzzyDismax handler! --> 
>>>>> <lst name="defaults">
>>>>>   <str name="defType">edismax</str>
>>>>>   <str name="mm">0</str>
>>>>>   <bool name="lowercaseOperators">false</bool>
>>>>>   <str name="fl">id,
>>>>>   image_thumb_large, image_thumb_medium, image_thumb_small,
>>>>>   image_thumb_xlarge, uri, user_id, last_name, first_name,
>>>>>   name, school, major, graduation_year, tutor_profile_id,
>>>>>   positive_reviews, negative_reviews, gender, about_experience,
>>>>>   about_extracurricular, time_approved</str>
>>>>>   <str name="q.alt">*:*</str>
>>>>>   <str name="qf">about_experience  about_extracurricular School  Major</str>
>>>>>   <str name="scores"></str>
>>>>>   <str name="sort">sum(interaction_responsiveness_score,profile_completeness_score,school_score,us_tax_id_score,highlight_score,${scores}) desc</str>
>>>>>   <str name="boost">log(sum(1,max(positive_reviews,0)))</str>
>>>>>   <str name="tie">0.1</str>
>>>>> </lst>
>>>>> </requestHandler>
>>>>> 
>>>>> I see this… [Solr 6.3.0]
>>>>> 
>>>>> org.apache.solr.common.SolrException: Unable to reload core [tutors_shard1_replica11]
>>>>> 	at org.apache.solr.core.CoreContainer.reload(CoreContainer.java:950)
>>>>> 	at org.apache.solr.core.SolrCore.lambda$getConfListener$6(SolrCore.java:2708)
>>>>> 	at org.apache.solr.cloud.ZkController.lambda$fireEventListeners$4(ZkController.java:2448)
>>>>> 	at java.lang.Thread.run(Thread.java:745)
>>>>> Caused by: org.apache.solr.common.SolrException: Could not load conf for core tutors_shard1_replica11: Error loading solr config from solrconfig.xml
>>>>> 	at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:85)
>>>>> 	at org.apache.solr.core.CoreContainer.reload(CoreContainer.java:942)
>>>>> 	... 3 more
>>>>> Caused by: org.apache.solr.common.SolrException: Error loading solr config from solrconfig.xml
>>>>> 	at org.apache.solr.core.SolrConfig.readFromResourceLoader(SolrConfig.java:187)
>>>>> 	at org.apache.solr.core.ConfigSetService.createSolrConfig(ConfigSetService.java:97)
>>>>> 	at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:77)
>>>>> 	... 4 more
>>>>> Caused by: org.apache.solr.common.SolrException: No system property or default value specified for scores value:sum(interaction_responsiveness_score,profile_completeness_score,school_score,us_tax_id_score,highlight_score,${scores}) desc
>>>>> 	at org.apache.solr.util.PropertiesUtil.substituteProperty(PropertiesUtil.java:65)
>>>>> 	at org.apache.solr.util.DOMUtil.substituteProperties(DOMUtil.java:298)
>>>>> 
>>>>> wunder
>>>>> Walter Underwood
>>>>> wunder@wunderwood.org
>>>>> http://observer.wunderwood.org/  (my blog)
>>>>> 
>>>>> 
>>>>>> On Feb 27, 2017, at 6:17 PM, Erik Hatcher <er...@gmail.com> wrote:
>>>>>> 
>>>>>> Walter -
>>>>>> 
>>>>>> How about this, for the latter part of your request:
>>>>>> 
>>>>>> /handler?features=a,b,c
>>>>>> 
>>>>>> with &sort=sum(${features}) desc
>>>>>> 
>>>>>> That ought to do the trick.   At first I thought the #foreach nature of the list of features was prohibitive, but since you’re literally plugging in the exact string value and it’s used as a comma-separated list then this should work.
>>>>>> 
>>>>>> But with the just a list of subject ID’s I think you’re in custom development now (or a JavaScript stage in a Fusion query pipeline ;) in building a SearchComponent that takes a `features` parameter and builds the sort param as needed from that.
>>>>>> 
>>>>>> 	Erik
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> On Feb 27, 2017, at 7:17 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>>>>>>> 
>>>>>>> We have documents with parameterized features. For a school subject (calculus, accounting), we have three sets of features. So for subject=4 and subject=186, we have:
>>>>>>> 
>>>>>>> feature_a_4: 0.9
>>>>>>> feature_b_4: 1.6
>>>>>>> feature_c_4: 8.2
>>>>>>> feature_a_186: 3.0
>>>>>>> feature_b_186: 2.1
>>>>>>> feature_c_186: 99.2
>>>>>>> 
>>>>>>> I’d like to pass in the subject IDs and make a function query (for sorting) from those, ending up with
>>>>>>> 
>>>>>>> sum(feature_x, feature_y, feature_a_4, feature_b_4, feature_c_4, feature_a_186, feature_b_186, feature c_186) desc
>>>>>>> 
>>>>>>> That would be used for the sort parameter.
>>>>>>> 
>>>>>>> Failing that, it would be nice so just pass in the parameterized portion, like this:
>>>>>>> 
>>>>>>> /handler?features=feature_a_4,feature_b_4,feature_c_4,feature_a_186,feature_b_186,feature c_186
>>>>>>> 
>>>>>>> Right now, I can’t even make a solrconfig.xml that will load. I’ve read everything I can find on params and function queries.
>>>>>>> 
>>>>>>> wunder
>>>>>>> Walter Underwood
>>>>>>> wunder@wunderwood.org
>>>>>>> http://observer.wunderwood.org/  (my blog)
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 
> 


Re: Using parameter values in a sort

Posted by Walter Underwood <wu...@wunderwood.org>.
No, I tried that before adding the default.

But the solrconfig.xml is rejected before there is a request, so this is not about requests. I did try “scores” in the requests, but of course it didn’t work because the solrconfig.xml was not loaded. I did not turn off parameter substitutions. This is a pretty vanilla solrconfig.xml.

wunder
Walter Underwood
wunder@wunderwood.org
http://observer.wunderwood.org/  (my blog)


> On Feb 27, 2017, at 6:44 PM, Erik Hatcher <er...@gmail.com> wrote:
> 
> `scores` (plural), you’ve got this below:   <str name="scores"></str>
> 
> Remove that, and like my previous e-mail, and use `scores` (plural) from the request and _should_ work?
> 
> 	Erik
> 
>> On Feb 27, 2017, at 9:42 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>> 
>> I’ve passed in a score parameter, but the solrconfig.xml is rejected before any requests.
>> 
>> Pretty ready to give up. The documentation around function queries and params is not working for me, though I’ve been using Solr for ten years. I have figured out a lot of systems. This is impenetrable.
>> 
>> wunder
>> Walter Underwood
>> wunder@wunderwood.org
>> http://observer.wunderwood.org/  (my blog)
>> 
>> 
>>> On Feb 27, 2017, at 6:35 PM, Erik Hatcher <er...@gmail.com> wrote:
>>> 
>>> You have an empty “scores” parameter in there.  You’re not showing your full search request, but did you provide that in the request?   Have you perhaps turned off parameter substitutions?
>>> 
>>> 	Erik
>>> 
>>>> On Feb 27, 2017, at 9:26 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>>>> 
>>>> With this in the config…
>>>> 
>>>> <requestHandler name="/display_tutor_rank" class="solr.SearchHandler">
>>>>  <!-- Note! Needs FuzzyDismax handler! --> 
>>>>  <lst name="defaults">
>>>>    <str name="defType">edismax</str>
>>>>    <str name="mm">0</str>
>>>>    <bool name="lowercaseOperators">false</bool>
>>>>    <str name="fl">id,
>>>>    image_thumb_large, image_thumb_medium, image_thumb_small,
>>>>    image_thumb_xlarge, uri, user_id, last_name, first_name,
>>>>    name, school, major, graduation_year, tutor_profile_id,
>>>>    positive_reviews, negative_reviews, gender, about_experience,
>>>>    about_extracurricular, time_approved</str>
>>>>    <str name="q.alt">*:*</str>
>>>>    <str name="qf">about_experience  about_extracurricular School  Major</str>
>>>>    <str name="scores"></str>
>>>>    <str name="sort">sum(interaction_responsiveness_score,profile_completeness_score,school_score,us_tax_id_score,highlight_score,${scores}) desc</str>
>>>>    <str name="boost">log(sum(1,max(positive_reviews,0)))</str>
>>>>    <str name="tie">0.1</str>
>>>>  </lst>
>>>> </requestHandler>
>>>> 
>>>> I see this… [Solr 6.3.0]
>>>> 
>>>> org.apache.solr.common.SolrException: Unable to reload core [tutors_shard1_replica11]
>>>> 	at org.apache.solr.core.CoreContainer.reload(CoreContainer.java:950)
>>>> 	at org.apache.solr.core.SolrCore.lambda$getConfListener$6(SolrCore.java:2708)
>>>> 	at org.apache.solr.cloud.ZkController.lambda$fireEventListeners$4(ZkController.java:2448)
>>>> 	at java.lang.Thread.run(Thread.java:745)
>>>> Caused by: org.apache.solr.common.SolrException: Could not load conf for core tutors_shard1_replica11: Error loading solr config from solrconfig.xml
>>>> 	at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:85)
>>>> 	at org.apache.solr.core.CoreContainer.reload(CoreContainer.java:942)
>>>> 	... 3 more
>>>> Caused by: org.apache.solr.common.SolrException: Error loading solr config from solrconfig.xml
>>>> 	at org.apache.solr.core.SolrConfig.readFromResourceLoader(SolrConfig.java:187)
>>>> 	at org.apache.solr.core.ConfigSetService.createSolrConfig(ConfigSetService.java:97)
>>>> 	at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:77)
>>>> 	... 4 more
>>>> Caused by: org.apache.solr.common.SolrException: No system property or default value specified for scores value:sum(interaction_responsiveness_score,profile_completeness_score,school_score,us_tax_id_score,highlight_score,${scores}) desc
>>>> 	at org.apache.solr.util.PropertiesUtil.substituteProperty(PropertiesUtil.java:65)
>>>> 	at org.apache.solr.util.DOMUtil.substituteProperties(DOMUtil.java:298)
>>>> 
>>>> wunder
>>>> Walter Underwood
>>>> wunder@wunderwood.org
>>>> http://observer.wunderwood.org/  (my blog)
>>>> 
>>>> 
>>>>> On Feb 27, 2017, at 6:17 PM, Erik Hatcher <er...@gmail.com> wrote:
>>>>> 
>>>>> Walter -
>>>>> 
>>>>> How about this, for the latter part of your request:
>>>>> 
>>>>> /handler?features=a,b,c
>>>>> 
>>>>> with &sort=sum(${features}) desc
>>>>> 
>>>>> That ought to do the trick.   At first I thought the #foreach nature of the list of features was prohibitive, but since you’re literally plugging in the exact string value and it’s used as a comma-separated list then this should work.
>>>>> 
>>>>> But with the just a list of subject ID’s I think you’re in custom development now (or a JavaScript stage in a Fusion query pipeline ;) in building a SearchComponent that takes a `features` parameter and builds the sort param as needed from that.
>>>>> 
>>>>> 	Erik
>>>>> 
>>>>> 
>>>>> 
>>>>>> On Feb 27, 2017, at 7:17 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>>>>>> 
>>>>>> We have documents with parameterized features. For a school subject (calculus, accounting), we have three sets of features. So for subject=4 and subject=186, we have:
>>>>>> 
>>>>>> feature_a_4: 0.9
>>>>>> feature_b_4: 1.6
>>>>>> feature_c_4: 8.2
>>>>>> feature_a_186: 3.0
>>>>>> feature_b_186: 2.1
>>>>>> feature_c_186: 99.2
>>>>>> 
>>>>>> I’d like to pass in the subject IDs and make a function query (for sorting) from those, ending up with
>>>>>> 
>>>>>> sum(feature_x, feature_y, feature_a_4, feature_b_4, feature_c_4, feature_a_186, feature_b_186, feature c_186) desc
>>>>>> 
>>>>>> That would be used for the sort parameter.
>>>>>> 
>>>>>> Failing that, it would be nice so just pass in the parameterized portion, like this:
>>>>>> 
>>>>>> /handler?features=feature_a_4,feature_b_4,feature_c_4,feature_a_186,feature_b_186,feature c_186
>>>>>> 
>>>>>> Right now, I can’t even make a solrconfig.xml that will load. I’ve read everything I can find on params and function queries.
>>>>>> 
>>>>>> wunder
>>>>>> Walter Underwood
>>>>>> wunder@wunderwood.org
>>>>>> http://observer.wunderwood.org/  (my blog)
>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 
> 


Re: Using parameter values in a sort

Posted by Erik Hatcher <er...@gmail.com>.
It looks like you’ve got score/scores mismatching going on.   

I feel your frustration through e-mail.   It’s voodoo for sure, but hopefully it’s just typos that are getting  you now.  I’d simplify it down to an example like I provided without mixing in any other variables or params (even for us seasoned pros, simplification is often the root of problem solving in frustrating times; get back to what works) and let’s see the request (and echoParam=all output when the request is successful).

	Erik


> On Feb 27, 2017, at 9:48 PM, Walter Underwood <wu...@wunderwood.org> wrote:
> 
> I added that line because I was getting an error about it being undefined.
> 
>       <str name="scores"></str>
> 
> At this point, I’m just doing random shit hoping it will work. There is not enough documentation to use this.
> 
> wunder
> Walter Underwood
> wunder@wunderwood.org
> http://observer.wunderwood.org/  (my blog)
> 
> 
>> On Feb 27, 2017, at 6:44 PM, Erik Hatcher <er...@gmail.com> wrote:
>> 
>> `scores` (plural), you’ve got this below:   <str name="scores"></str>
>> 
>> Remove that, and like my previous e-mail, and use `scores` (plural) from the request and _should_ work?
>> 
>> 	Erik
>> 
>>> On Feb 27, 2017, at 9:42 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>>> 
>>> I’ve passed in a score parameter, but the solrconfig.xml is rejected before any requests.
>>> 
>>> Pretty ready to give up. The documentation around function queries and params is not working for me, though I’ve been using Solr for ten years. I have figured out a lot of systems. This is impenetrable.
>>> 
>>> wunder
>>> Walter Underwood
>>> wunder@wunderwood.org
>>> http://observer.wunderwood.org/  (my blog)
>>> 
>>> 
>>>> On Feb 27, 2017, at 6:35 PM, Erik Hatcher <er...@gmail.com> wrote:
>>>> 
>>>> You have an empty “scores” parameter in there.  You’re not showing your full search request, but did you provide that in the request?   Have you perhaps turned off parameter substitutions?
>>>> 
>>>> 	Erik
>>>> 
>>>>> On Feb 27, 2017, at 9:26 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>>>>> 
>>>>> With this in the config…
>>>>> 
>>>>> <requestHandler name="/display_tutor_rank" class="solr.SearchHandler">
>>>>> <!-- Note! Needs FuzzyDismax handler! --> 
>>>>> <lst name="defaults">
>>>>>   <str name="defType">edismax</str>
>>>>>   <str name="mm">0</str>
>>>>>   <bool name="lowercaseOperators">false</bool>
>>>>>   <str name="fl">id,
>>>>>   image_thumb_large, image_thumb_medium, image_thumb_small,
>>>>>   image_thumb_xlarge, uri, user_id, last_name, first_name,
>>>>>   name, school, major, graduation_year, tutor_profile_id,
>>>>>   positive_reviews, negative_reviews, gender, about_experience,
>>>>>   about_extracurricular, time_approved</str>
>>>>>   <str name="q.alt">*:*</str>
>>>>>   <str name="qf">about_experience  about_extracurricular School  Major</str>
>>>>>   <str name="scores"></str>
>>>>>   <str name="sort">sum(interaction_responsiveness_score,profile_completeness_score,school_score,us_tax_id_score,highlight_score,${scores}) desc</str>
>>>>>   <str name="boost">log(sum(1,max(positive_reviews,0)))</str>
>>>>>   <str name="tie">0.1</str>
>>>>> </lst>
>>>>> </requestHandler>
>>>>> 
>>>>> I see this… [Solr 6.3.0]
>>>>> 
>>>>> org.apache.solr.common.SolrException: Unable to reload core [tutors_shard1_replica11]
>>>>> 	at org.apache.solr.core.CoreContainer.reload(CoreContainer.java:950)
>>>>> 	at org.apache.solr.core.SolrCore.lambda$getConfListener$6(SolrCore.java:2708)
>>>>> 	at org.apache.solr.cloud.ZkController.lambda$fireEventListeners$4(ZkController.java:2448)
>>>>> 	at java.lang.Thread.run(Thread.java:745)
>>>>> Caused by: org.apache.solr.common.SolrException: Could not load conf for core tutors_shard1_replica11: Error loading solr config from solrconfig.xml
>>>>> 	at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:85)
>>>>> 	at org.apache.solr.core.CoreContainer.reload(CoreContainer.java:942)
>>>>> 	... 3 more
>>>>> Caused by: org.apache.solr.common.SolrException: Error loading solr config from solrconfig.xml
>>>>> 	at org.apache.solr.core.SolrConfig.readFromResourceLoader(SolrConfig.java:187)
>>>>> 	at org.apache.solr.core.ConfigSetService.createSolrConfig(ConfigSetService.java:97)
>>>>> 	at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:77)
>>>>> 	... 4 more
>>>>> Caused by: org.apache.solr.common.SolrException: No system property or default value specified for scores value:sum(interaction_responsiveness_score,profile_completeness_score,school_score,us_tax_id_score,highlight_score,${scores}) desc
>>>>> 	at org.apache.solr.util.PropertiesUtil.substituteProperty(PropertiesUtil.java:65)
>>>>> 	at org.apache.solr.util.DOMUtil.substituteProperties(DOMUtil.java:298)
>>>>> 
>>>>> wunder
>>>>> Walter Underwood
>>>>> wunder@wunderwood.org
>>>>> http://observer.wunderwood.org/  (my blog)
>>>>> 
>>>>> 
>>>>>> On Feb 27, 2017, at 6:17 PM, Erik Hatcher <er...@gmail.com> wrote:
>>>>>> 
>>>>>> Walter -
>>>>>> 
>>>>>> How about this, for the latter part of your request:
>>>>>> 
>>>>>> /handler?features=a,b,c
>>>>>> 
>>>>>> with &sort=sum(${features}) desc
>>>>>> 
>>>>>> That ought to do the trick.   At first I thought the #foreach nature of the list of features was prohibitive, but since you’re literally plugging in the exact string value and it’s used as a comma-separated list then this should work.
>>>>>> 
>>>>>> But with the just a list of subject ID’s I think you’re in custom development now (or a JavaScript stage in a Fusion query pipeline ;) in building a SearchComponent that takes a `features` parameter and builds the sort param as needed from that.
>>>>>> 
>>>>>> 	Erik
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> On Feb 27, 2017, at 7:17 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>>>>>>> 
>>>>>>> We have documents with parameterized features. For a school subject (calculus, accounting), we have three sets of features. So for subject=4 and subject=186, we have:
>>>>>>> 
>>>>>>> feature_a_4: 0.9
>>>>>>> feature_b_4: 1.6
>>>>>>> feature_c_4: 8.2
>>>>>>> feature_a_186: 3.0
>>>>>>> feature_b_186: 2.1
>>>>>>> feature_c_186: 99.2
>>>>>>> 
>>>>>>> I’d like to pass in the subject IDs and make a function query (for sorting) from those, ending up with
>>>>>>> 
>>>>>>> sum(feature_x, feature_y, feature_a_4, feature_b_4, feature_c_4, feature_a_186, feature_b_186, feature c_186) desc
>>>>>>> 
>>>>>>> That would be used for the sort parameter.
>>>>>>> 
>>>>>>> Failing that, it would be nice so just pass in the parameterized portion, like this:
>>>>>>> 
>>>>>>> /handler?features=feature_a_4,feature_b_4,feature_c_4,feature_a_186,feature_b_186,feature c_186
>>>>>>> 
>>>>>>> Right now, I can’t even make a solrconfig.xml that will load. I’ve read everything I can find on params and function queries.
>>>>>>> 
>>>>>>> wunder
>>>>>>> Walter Underwood
>>>>>>> wunder@wunderwood.org
>>>>>>> http://observer.wunderwood.org/  (my blog)
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 
> 


Re: Using parameter values in a sort

Posted by Walter Underwood <wu...@wunderwood.org>.
I added that line because I was getting an error about it being undefined.

       <str name="scores"></str>

At this point, I’m just doing random shit hoping it will work. There is not enough documentation to use this.

wunder
Walter Underwood
wunder@wunderwood.org
http://observer.wunderwood.org/  (my blog)


> On Feb 27, 2017, at 6:44 PM, Erik Hatcher <er...@gmail.com> wrote:
> 
> `scores` (plural), you’ve got this below:   <str name="scores"></str>
> 
> Remove that, and like my previous e-mail, and use `scores` (plural) from the request and _should_ work?
> 
> 	Erik
> 
>> On Feb 27, 2017, at 9:42 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>> 
>> I’ve passed in a score parameter, but the solrconfig.xml is rejected before any requests.
>> 
>> Pretty ready to give up. The documentation around function queries and params is not working for me, though I’ve been using Solr for ten years. I have figured out a lot of systems. This is impenetrable.
>> 
>> wunder
>> Walter Underwood
>> wunder@wunderwood.org
>> http://observer.wunderwood.org/  (my blog)
>> 
>> 
>>> On Feb 27, 2017, at 6:35 PM, Erik Hatcher <er...@gmail.com> wrote:
>>> 
>>> You have an empty “scores” parameter in there.  You’re not showing your full search request, but did you provide that in the request?   Have you perhaps turned off parameter substitutions?
>>> 
>>> 	Erik
>>> 
>>>> On Feb 27, 2017, at 9:26 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>>>> 
>>>> With this in the config…
>>>> 
>>>> <requestHandler name="/display_tutor_rank" class="solr.SearchHandler">
>>>>  <!-- Note! Needs FuzzyDismax handler! --> 
>>>>  <lst name="defaults">
>>>>    <str name="defType">edismax</str>
>>>>    <str name="mm">0</str>
>>>>    <bool name="lowercaseOperators">false</bool>
>>>>    <str name="fl">id,
>>>>    image_thumb_large, image_thumb_medium, image_thumb_small,
>>>>    image_thumb_xlarge, uri, user_id, last_name, first_name,
>>>>    name, school, major, graduation_year, tutor_profile_id,
>>>>    positive_reviews, negative_reviews, gender, about_experience,
>>>>    about_extracurricular, time_approved</str>
>>>>    <str name="q.alt">*:*</str>
>>>>    <str name="qf">about_experience  about_extracurricular School  Major</str>
>>>>    <str name="scores"></str>
>>>>    <str name="sort">sum(interaction_responsiveness_score,profile_completeness_score,school_score,us_tax_id_score,highlight_score,${scores}) desc</str>
>>>>    <str name="boost">log(sum(1,max(positive_reviews,0)))</str>
>>>>    <str name="tie">0.1</str>
>>>>  </lst>
>>>> </requestHandler>
>>>> 
>>>> I see this… [Solr 6.3.0]
>>>> 
>>>> org.apache.solr.common.SolrException: Unable to reload core [tutors_shard1_replica11]
>>>> 	at org.apache.solr.core.CoreContainer.reload(CoreContainer.java:950)
>>>> 	at org.apache.solr.core.SolrCore.lambda$getConfListener$6(SolrCore.java:2708)
>>>> 	at org.apache.solr.cloud.ZkController.lambda$fireEventListeners$4(ZkController.java:2448)
>>>> 	at java.lang.Thread.run(Thread.java:745)
>>>> Caused by: org.apache.solr.common.SolrException: Could not load conf for core tutors_shard1_replica11: Error loading solr config from solrconfig.xml
>>>> 	at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:85)
>>>> 	at org.apache.solr.core.CoreContainer.reload(CoreContainer.java:942)
>>>> 	... 3 more
>>>> Caused by: org.apache.solr.common.SolrException: Error loading solr config from solrconfig.xml
>>>> 	at org.apache.solr.core.SolrConfig.readFromResourceLoader(SolrConfig.java:187)
>>>> 	at org.apache.solr.core.ConfigSetService.createSolrConfig(ConfigSetService.java:97)
>>>> 	at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:77)
>>>> 	... 4 more
>>>> Caused by: org.apache.solr.common.SolrException: No system property or default value specified for scores value:sum(interaction_responsiveness_score,profile_completeness_score,school_score,us_tax_id_score,highlight_score,${scores}) desc
>>>> 	at org.apache.solr.util.PropertiesUtil.substituteProperty(PropertiesUtil.java:65)
>>>> 	at org.apache.solr.util.DOMUtil.substituteProperties(DOMUtil.java:298)
>>>> 
>>>> wunder
>>>> Walter Underwood
>>>> wunder@wunderwood.org
>>>> http://observer.wunderwood.org/  (my blog)
>>>> 
>>>> 
>>>>> On Feb 27, 2017, at 6:17 PM, Erik Hatcher <er...@gmail.com> wrote:
>>>>> 
>>>>> Walter -
>>>>> 
>>>>> How about this, for the latter part of your request:
>>>>> 
>>>>> /handler?features=a,b,c
>>>>> 
>>>>> with &sort=sum(${features}) desc
>>>>> 
>>>>> That ought to do the trick.   At first I thought the #foreach nature of the list of features was prohibitive, but since you’re literally plugging in the exact string value and it’s used as a comma-separated list then this should work.
>>>>> 
>>>>> But with the just a list of subject ID’s I think you’re in custom development now (or a JavaScript stage in a Fusion query pipeline ;) in building a SearchComponent that takes a `features` parameter and builds the sort param as needed from that.
>>>>> 
>>>>> 	Erik
>>>>> 
>>>>> 
>>>>> 
>>>>>> On Feb 27, 2017, at 7:17 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>>>>>> 
>>>>>> We have documents with parameterized features. For a school subject (calculus, accounting), we have three sets of features. So for subject=4 and subject=186, we have:
>>>>>> 
>>>>>> feature_a_4: 0.9
>>>>>> feature_b_4: 1.6
>>>>>> feature_c_4: 8.2
>>>>>> feature_a_186: 3.0
>>>>>> feature_b_186: 2.1
>>>>>> feature_c_186: 99.2
>>>>>> 
>>>>>> I’d like to pass in the subject IDs and make a function query (for sorting) from those, ending up with
>>>>>> 
>>>>>> sum(feature_x, feature_y, feature_a_4, feature_b_4, feature_c_4, feature_a_186, feature_b_186, feature c_186) desc
>>>>>> 
>>>>>> That would be used for the sort parameter.
>>>>>> 
>>>>>> Failing that, it would be nice so just pass in the parameterized portion, like this:
>>>>>> 
>>>>>> /handler?features=feature_a_4,feature_b_4,feature_c_4,feature_a_186,feature_b_186,feature c_186
>>>>>> 
>>>>>> Right now, I can’t even make a solrconfig.xml that will load. I’ve read everything I can find on params and function queries.
>>>>>> 
>>>>>> wunder
>>>>>> Walter Underwood
>>>>>> wunder@wunderwood.org
>>>>>> http://observer.wunderwood.org/  (my blog)
>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 
> 


Re: Using parameter values in a sort

Posted by Erik Hatcher <er...@gmail.com>.
`scores` (plural), you’ve got this below:   <str name="scores"></str>

Remove that, and like my previous e-mail, and use `scores` (plural) from the request and _should_ work?

	Erik

> On Feb 27, 2017, at 9:42 PM, Walter Underwood <wu...@wunderwood.org> wrote:
> 
> I’ve passed in a score parameter, but the solrconfig.xml is rejected before any requests.
> 
> Pretty ready to give up. The documentation around function queries and params is not working for me, though I’ve been using Solr for ten years. I have figured out a lot of systems. This is impenetrable.
> 
> wunder
> Walter Underwood
> wunder@wunderwood.org
> http://observer.wunderwood.org/  (my blog)
> 
> 
>> On Feb 27, 2017, at 6:35 PM, Erik Hatcher <er...@gmail.com> wrote:
>> 
>> You have an empty “scores” parameter in there.  You’re not showing your full search request, but did you provide that in the request?   Have you perhaps turned off parameter substitutions?
>> 
>> 	Erik
>> 
>>> On Feb 27, 2017, at 9:26 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>>> 
>>> With this in the config…
>>> 
>>> <requestHandler name="/display_tutor_rank" class="solr.SearchHandler">
>>>   <!-- Note! Needs FuzzyDismax handler! --> 
>>>   <lst name="defaults">
>>>     <str name="defType">edismax</str>
>>>     <str name="mm">0</str>
>>>     <bool name="lowercaseOperators">false</bool>
>>>     <str name="fl">id,
>>>     image_thumb_large, image_thumb_medium, image_thumb_small,
>>>     image_thumb_xlarge, uri, user_id, last_name, first_name,
>>>     name, school, major, graduation_year, tutor_profile_id,
>>>     positive_reviews, negative_reviews, gender, about_experience,
>>>     about_extracurricular, time_approved</str>
>>>     <str name="q.alt">*:*</str>
>>>     <str name="qf">about_experience  about_extracurricular School  Major</str>
>>>     <str name="scores"></str>
>>>     <str name="sort">sum(interaction_responsiveness_score,profile_completeness_score,school_score,us_tax_id_score,highlight_score,${scores}) desc</str>
>>>     <str name="boost">log(sum(1,max(positive_reviews,0)))</str>
>>>     <str name="tie">0.1</str>
>>>   </lst>
>>> </requestHandler>
>>> 
>>> I see this… [Solr 6.3.0]
>>> 
>>> org.apache.solr.common.SolrException: Unable to reload core [tutors_shard1_replica11]
>>> 	at org.apache.solr.core.CoreContainer.reload(CoreContainer.java:950)
>>> 	at org.apache.solr.core.SolrCore.lambda$getConfListener$6(SolrCore.java:2708)
>>> 	at org.apache.solr.cloud.ZkController.lambda$fireEventListeners$4(ZkController.java:2448)
>>> 	at java.lang.Thread.run(Thread.java:745)
>>> Caused by: org.apache.solr.common.SolrException: Could not load conf for core tutors_shard1_replica11: Error loading solr config from solrconfig.xml
>>> 	at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:85)
>>> 	at org.apache.solr.core.CoreContainer.reload(CoreContainer.java:942)
>>> 	... 3 more
>>> Caused by: org.apache.solr.common.SolrException: Error loading solr config from solrconfig.xml
>>> 	at org.apache.solr.core.SolrConfig.readFromResourceLoader(SolrConfig.java:187)
>>> 	at org.apache.solr.core.ConfigSetService.createSolrConfig(ConfigSetService.java:97)
>>> 	at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:77)
>>> 	... 4 more
>>> Caused by: org.apache.solr.common.SolrException: No system property or default value specified for scores value:sum(interaction_responsiveness_score,profile_completeness_score,school_score,us_tax_id_score,highlight_score,${scores}) desc
>>> 	at org.apache.solr.util.PropertiesUtil.substituteProperty(PropertiesUtil.java:65)
>>> 	at org.apache.solr.util.DOMUtil.substituteProperties(DOMUtil.java:298)
>>> 
>>> wunder
>>> Walter Underwood
>>> wunder@wunderwood.org
>>> http://observer.wunderwood.org/  (my blog)
>>> 
>>> 
>>>> On Feb 27, 2017, at 6:17 PM, Erik Hatcher <er...@gmail.com> wrote:
>>>> 
>>>> Walter -
>>>> 
>>>> How about this, for the latter part of your request:
>>>> 
>>>> /handler?features=a,b,c
>>>> 
>>>>  with &sort=sum(${features}) desc
>>>> 
>>>> That ought to do the trick.   At first I thought the #foreach nature of the list of features was prohibitive, but since you’re literally plugging in the exact string value and it’s used as a comma-separated list then this should work.
>>>> 
>>>> But with the just a list of subject ID’s I think you’re in custom development now (or a JavaScript stage in a Fusion query pipeline ;) in building a SearchComponent that takes a `features` parameter and builds the sort param as needed from that.
>>>> 
>>>> 	Erik
>>>> 
>>>> 
>>>> 
>>>>> On Feb 27, 2017, at 7:17 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>>>>> 
>>>>> We have documents with parameterized features. For a school subject (calculus, accounting), we have three sets of features. So for subject=4 and subject=186, we have:
>>>>> 
>>>>> feature_a_4: 0.9
>>>>> feature_b_4: 1.6
>>>>> feature_c_4: 8.2
>>>>> feature_a_186: 3.0
>>>>> feature_b_186: 2.1
>>>>> feature_c_186: 99.2
>>>>> 
>>>>> I’d like to pass in the subject IDs and make a function query (for sorting) from those, ending up with
>>>>> 
>>>>> sum(feature_x, feature_y, feature_a_4, feature_b_4, feature_c_4, feature_a_186, feature_b_186, feature c_186) desc
>>>>> 
>>>>> That would be used for the sort parameter.
>>>>> 
>>>>> Failing that, it would be nice so just pass in the parameterized portion, like this:
>>>>> 
>>>>> /handler?features=feature_a_4,feature_b_4,feature_c_4,feature_a_186,feature_b_186,feature c_186
>>>>> 
>>>>> Right now, I can’t even make a solrconfig.xml that will load. I’ve read everything I can find on params and function queries.
>>>>> 
>>>>> wunder
>>>>> Walter Underwood
>>>>> wunder@wunderwood.org
>>>>> http://observer.wunderwood.org/  (my blog)
>>>>> 
>>>>> 
>>>> 
>>> 
>> 
> 


Re: Using parameter values in a sort

Posted by Walter Underwood <wu...@wunderwood.org>.
I’ve passed in a score parameter, but the solrconfig.xml is rejected before any requests.

Pretty ready to give up. The documentation around function queries and params is not working for me, though I’ve been using Solr for ten years. I have figured out a lot of systems. This is impenetrable.

wunder
Walter Underwood
wunder@wunderwood.org
http://observer.wunderwood.org/  (my blog)


> On Feb 27, 2017, at 6:35 PM, Erik Hatcher <er...@gmail.com> wrote:
> 
> You have an empty “scores” parameter in there.  You’re not showing your full search request, but did you provide that in the request?   Have you perhaps turned off parameter substitutions?
> 
> 	Erik
> 
>> On Feb 27, 2017, at 9:26 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>> 
>> With this in the config…
>> 
>> <requestHandler name="/display_tutor_rank" class="solr.SearchHandler">
>>    <!-- Note! Needs FuzzyDismax handler! --> 
>>    <lst name="defaults">
>>      <str name="defType">edismax</str>
>>      <str name="mm">0</str>
>>      <bool name="lowercaseOperators">false</bool>
>>      <str name="fl">id,
>>      image_thumb_large, image_thumb_medium, image_thumb_small,
>>      image_thumb_xlarge, uri, user_id, last_name, first_name,
>>      name, school, major, graduation_year, tutor_profile_id,
>>      positive_reviews, negative_reviews, gender, about_experience,
>>      about_extracurricular, time_approved</str>
>>      <str name="q.alt">*:*</str>
>>      <str name="qf">about_experience  about_extracurricular School  Major</str>
>>      <str name="scores"></str>
>>      <str name="sort">sum(interaction_responsiveness_score,profile_completeness_score,school_score,us_tax_id_score,highlight_score,${scores}) desc</str>
>>      <str name="boost">log(sum(1,max(positive_reviews,0)))</str>
>>      <str name="tie">0.1</str>
>>    </lst>
>> </requestHandler>
>> 
>> I see this… [Solr 6.3.0]
>> 
>> org.apache.solr.common.SolrException: Unable to reload core [tutors_shard1_replica11]
>> 	at org.apache.solr.core.CoreContainer.reload(CoreContainer.java:950)
>> 	at org.apache.solr.core.SolrCore.lambda$getConfListener$6(SolrCore.java:2708)
>> 	at org.apache.solr.cloud.ZkController.lambda$fireEventListeners$4(ZkController.java:2448)
>> 	at java.lang.Thread.run(Thread.java:745)
>> Caused by: org.apache.solr.common.SolrException: Could not load conf for core tutors_shard1_replica11: Error loading solr config from solrconfig.xml
>> 	at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:85)
>> 	at org.apache.solr.core.CoreContainer.reload(CoreContainer.java:942)
>> 	... 3 more
>> Caused by: org.apache.solr.common.SolrException: Error loading solr config from solrconfig.xml
>> 	at org.apache.solr.core.SolrConfig.readFromResourceLoader(SolrConfig.java:187)
>> 	at org.apache.solr.core.ConfigSetService.createSolrConfig(ConfigSetService.java:97)
>> 	at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:77)
>> 	... 4 more
>> Caused by: org.apache.solr.common.SolrException: No system property or default value specified for scores value:sum(interaction_responsiveness_score,profile_completeness_score,school_score,us_tax_id_score,highlight_score,${scores}) desc
>> 	at org.apache.solr.util.PropertiesUtil.substituteProperty(PropertiesUtil.java:65)
>> 	at org.apache.solr.util.DOMUtil.substituteProperties(DOMUtil.java:298)
>> 
>> wunder
>> Walter Underwood
>> wunder@wunderwood.org
>> http://observer.wunderwood.org/  (my blog)
>> 
>> 
>>> On Feb 27, 2017, at 6:17 PM, Erik Hatcher <er...@gmail.com> wrote:
>>> 
>>> Walter -
>>> 
>>> How about this, for the latter part of your request:
>>> 
>>> /handler?features=a,b,c
>>> 
>>>   with &sort=sum(${features}) desc
>>> 
>>> That ought to do the trick.   At first I thought the #foreach nature of the list of features was prohibitive, but since you’re literally plugging in the exact string value and it’s used as a comma-separated list then this should work.
>>> 
>>> But with the just a list of subject ID’s I think you’re in custom development now (or a JavaScript stage in a Fusion query pipeline ;) in building a SearchComponent that takes a `features` parameter and builds the sort param as needed from that.
>>> 
>>> 	Erik
>>> 
>>> 
>>> 
>>>> On Feb 27, 2017, at 7:17 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>>>> 
>>>> We have documents with parameterized features. For a school subject (calculus, accounting), we have three sets of features. So for subject=4 and subject=186, we have:
>>>> 
>>>> feature_a_4: 0.9
>>>> feature_b_4: 1.6
>>>> feature_c_4: 8.2
>>>> feature_a_186: 3.0
>>>> feature_b_186: 2.1
>>>> feature_c_186: 99.2
>>>> 
>>>> I’d like to pass in the subject IDs and make a function query (for sorting) from those, ending up with
>>>> 
>>>> sum(feature_x, feature_y, feature_a_4, feature_b_4, feature_c_4, feature_a_186, feature_b_186, feature c_186) desc
>>>> 
>>>> That would be used for the sort parameter.
>>>> 
>>>> Failing that, it would be nice so just pass in the parameterized portion, like this:
>>>> 
>>>> /handler?features=feature_a_4,feature_b_4,feature_c_4,feature_a_186,feature_b_186,feature c_186
>>>> 
>>>> Right now, I can’t even make a solrconfig.xml that will load. I’ve read everything I can find on params and function queries.
>>>> 
>>>> wunder
>>>> Walter Underwood
>>>> wunder@wunderwood.org
>>>> http://observer.wunderwood.org/  (my blog)
>>>> 
>>>> 
>>> 
>> 
> 


Re: Using parameter values in a sort

Posted by Erik Hatcher <er...@gmail.com>.
You have an empty “scores” parameter in there.  You’re not showing your full search request, but did you provide that in the request?   Have you perhaps turned off parameter substitutions?

	Erik




> On Feb 27, 2017, at 9:26 PM, Walter Underwood <wu...@wunderwood.org> wrote:
> 
> With this in the config…
> 
> <requestHandler name="/display_tutor_rank" class="solr.SearchHandler">
>     <!-- Note! Needs FuzzyDismax handler! --> 
>     <lst name="defaults">
>       <str name="defType">edismax</str>
>       <str name="mm">0</str>
>       <bool name="lowercaseOperators">false</bool>
>       <str name="fl">id,
>       image_thumb_large, image_thumb_medium, image_thumb_small,
>       image_thumb_xlarge, uri, user_id, last_name, first_name,
>       name, school, major, graduation_year, tutor_profile_id,
>       positive_reviews, negative_reviews, gender, about_experience,
>       about_extracurricular, time_approved</str>
>       <str name="q.alt">*:*</str>
>       <str name="qf">about_experience  about_extracurricular School  Major</str>
>       <str name="scores"></str>
>       <str name="sort">sum(interaction_responsiveness_score,profile_completeness_score,school_score,us_tax_id_score,highlight_score,${scores}) desc</str>
>       <str name="boost">log(sum(1,max(positive_reviews,0)))</str>
>       <str name="tie">0.1</str>
>     </lst>
>  </requestHandler>
> 
> I see this… [Solr 6.3.0]
> 
> org.apache.solr.common.SolrException: Unable to reload core [tutors_shard1_replica11]
> 	at org.apache.solr.core.CoreContainer.reload(CoreContainer.java:950)
> 	at org.apache.solr.core.SolrCore.lambda$getConfListener$6(SolrCore.java:2708)
> 	at org.apache.solr.cloud.ZkController.lambda$fireEventListeners$4(ZkController.java:2448)
> 	at java.lang.Thread.run(Thread.java:745)
> Caused by: org.apache.solr.common.SolrException: Could not load conf for core tutors_shard1_replica11: Error loading solr config from solrconfig.xml
> 	at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:85)
> 	at org.apache.solr.core.CoreContainer.reload(CoreContainer.java:942)
> 	... 3 more
> Caused by: org.apache.solr.common.SolrException: Error loading solr config from solrconfig.xml
> 	at org.apache.solr.core.SolrConfig.readFromResourceLoader(SolrConfig.java:187)
> 	at org.apache.solr.core.ConfigSetService.createSolrConfig(ConfigSetService.java:97)
> 	at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:77)
> 	... 4 more
> Caused by: org.apache.solr.common.SolrException: No system property or default value specified for scores value:sum(interaction_responsiveness_score,profile_completeness_score,school_score,us_tax_id_score,highlight_score,${scores}) desc
> 	at org.apache.solr.util.PropertiesUtil.substituteProperty(PropertiesUtil.java:65)
> 	at org.apache.solr.util.DOMUtil.substituteProperties(DOMUtil.java:298)
> 
> wunder
> Walter Underwood
> wunder@wunderwood.org
> http://observer.wunderwood.org/  (my blog)
> 
> 
>> On Feb 27, 2017, at 6:17 PM, Erik Hatcher <er...@gmail.com> wrote:
>> 
>> Walter -
>> 
>> How about this, for the latter part of your request:
>> 
>>  /handler?features=a,b,c
>> 
>>    with &sort=sum(${features}) desc
>> 
>> That ought to do the trick.   At first I thought the #foreach nature of the list of features was prohibitive, but since you’re literally plugging in the exact string value and it’s used as a comma-separated list then this should work.
>> 
>> But with the just a list of subject ID’s I think you’re in custom development now (or a JavaScript stage in a Fusion query pipeline ;) in building a SearchComponent that takes a `features` parameter and builds the sort param as needed from that.
>> 
>> 	Erik
>> 
>> 
>> 
>>> On Feb 27, 2017, at 7:17 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>>> 
>>> We have documents with parameterized features. For a school subject (calculus, accounting), we have three sets of features. So for subject=4 and subject=186, we have:
>>> 
>>> feature_a_4: 0.9
>>> feature_b_4: 1.6
>>> feature_c_4: 8.2
>>> feature_a_186: 3.0
>>> feature_b_186: 2.1
>>> feature_c_186: 99.2
>>> 
>>> I’d like to pass in the subject IDs and make a function query (for sorting) from those, ending up with
>>> 
>>> sum(feature_x, feature_y, feature_a_4, feature_b_4, feature_c_4, feature_a_186, feature_b_186, feature c_186) desc
>>> 
>>> That would be used for the sort parameter.
>>> 
>>> Failing that, it would be nice so just pass in the parameterized portion, like this:
>>> 
>>> /handler?features=feature_a_4,feature_b_4,feature_c_4,feature_a_186,feature_b_186,feature c_186
>>> 
>>> Right now, I can’t even make a solrconfig.xml that will load. I’ve read everything I can find on params and function queries.
>>> 
>>> wunder
>>> Walter Underwood
>>> wunder@wunderwood.org
>>> http://observer.wunderwood.org/  (my blog)
>>> 
>>> 
>> 
> 


Re: Using parameter values in a sort

Posted by Walter Underwood <wu...@wunderwood.org>.
With this in the config…

 <requestHandler name="/display_tutor_rank" class="solr.SearchHandler">
     <!-- Note! Needs FuzzyDismax handler! --> 
     <lst name="defaults">
       <str name="defType">edismax</str>
       <str name="mm">0</str>
       <bool name="lowercaseOperators">false</bool>
       <str name="fl">id,
       image_thumb_large, image_thumb_medium, image_thumb_small,
       image_thumb_xlarge, uri, user_id, last_name, first_name,
       name, school, major, graduation_year, tutor_profile_id,
       positive_reviews, negative_reviews, gender, about_experience,
       about_extracurricular, time_approved</str>
       <str name="q.alt">*:*</str>
       <str name="qf">about_experience  about_extracurricular School  Major</str>
       <str name="scores"></str>
       <str name="sort">sum(interaction_responsiveness_score,profile_completeness_score,school_score,us_tax_id_score,highlight_score,${scores}) desc</str>
       <str name="boost">log(sum(1,max(positive_reviews,0)))</str>
       <str name="tie">0.1</str>
     </lst>
  </requestHandler>

I see this… [Solr 6.3.0]

org.apache.solr.common.SolrException: Unable to reload core [tutors_shard1_replica11]
	at org.apache.solr.core.CoreContainer.reload(CoreContainer.java:950)
	at org.apache.solr.core.SolrCore.lambda$getConfListener$6(SolrCore.java:2708)
	at org.apache.solr.cloud.ZkController.lambda$fireEventListeners$4(ZkController.java:2448)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.solr.common.SolrException: Could not load conf for core tutors_shard1_replica11: Error loading solr config from solrconfig.xml
	at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:85)
	at org.apache.solr.core.CoreContainer.reload(CoreContainer.java:942)
	... 3 more
Caused by: org.apache.solr.common.SolrException: Error loading solr config from solrconfig.xml
	at org.apache.solr.core.SolrConfig.readFromResourceLoader(SolrConfig.java:187)
	at org.apache.solr.core.ConfigSetService.createSolrConfig(ConfigSetService.java:97)
	at org.apache.solr.core.ConfigSetService.getConfig(ConfigSetService.java:77)
	... 4 more
Caused by: org.apache.solr.common.SolrException: No system property or default value specified for scores value:sum(interaction_responsiveness_score,profile_completeness_score,school_score,us_tax_id_score,highlight_score,${scores}) desc
	at org.apache.solr.util.PropertiesUtil.substituteProperty(PropertiesUtil.java:65)
	at org.apache.solr.util.DOMUtil.substituteProperties(DOMUtil.java:298)

wunder
Walter Underwood
wunder@wunderwood.org
http://observer.wunderwood.org/  (my blog)


> On Feb 27, 2017, at 6:17 PM, Erik Hatcher <er...@gmail.com> wrote:
> 
> Walter -
> 
> How about this, for the latter part of your request:
> 
>   /handler?features=a,b,c
> 
>     with &sort=sum(${features}) desc
> 
> That ought to do the trick.   At first I thought the #foreach nature of the list of features was prohibitive, but since you’re literally plugging in the exact string value and it’s used as a comma-separated list then this should work.
> 
> But with the just a list of subject ID’s I think you’re in custom development now (or a JavaScript stage in a Fusion query pipeline ;) in building a SearchComponent that takes a `features` parameter and builds the sort param as needed from that.
> 
> 	Erik
> 
> 
> 
>> On Feb 27, 2017, at 7:17 PM, Walter Underwood <wu...@wunderwood.org> wrote:
>> 
>> We have documents with parameterized features. For a school subject (calculus, accounting), we have three sets of features. So for subject=4 and subject=186, we have:
>> 
>> feature_a_4: 0.9
>> feature_b_4: 1.6
>> feature_c_4: 8.2
>> feature_a_186: 3.0
>> feature_b_186: 2.1
>> feature_c_186: 99.2
>> 
>> I’d like to pass in the subject IDs and make a function query (for sorting) from those, ending up with
>> 
>> sum(feature_x, feature_y, feature_a_4, feature_b_4, feature_c_4, feature_a_186, feature_b_186, feature c_186) desc
>> 
>> That would be used for the sort parameter.
>> 
>> Failing that, it would be nice so just pass in the parameterized portion, like this:
>> 
>> /handler?features=feature_a_4,feature_b_4,feature_c_4,feature_a_186,feature_b_186,feature c_186
>> 
>> Right now, I can’t even make a solrconfig.xml that will load. I’ve read everything I can find on params and function queries.
>> 
>> wunder
>> Walter Underwood
>> wunder@wunderwood.org
>> http://observer.wunderwood.org/  (my blog)
>> 
>> 
> 


Re: Using parameter values in a sort

Posted by Erik Hatcher <er...@gmail.com>.
Walter -

How about this, for the latter part of your request:

   /handler?features=a,b,c

     with &sort=sum(${features}) desc

That ought to do the trick.   At first I thought the #foreach nature of the list of features was prohibitive, but since you’re literally plugging in the exact string value and it’s used as a comma-separated list then this should work.

But with the just a list of subject ID’s I think you’re in custom development now (or a JavaScript stage in a Fusion query pipeline ;) in building a SearchComponent that takes a `features` parameter and builds the sort param as needed from that.

	Erik



> On Feb 27, 2017, at 7:17 PM, Walter Underwood <wu...@wunderwood.org> wrote:
> 
> We have documents with parameterized features. For a school subject (calculus, accounting), we have three sets of features. So for subject=4 and subject=186, we have:
> 
> feature_a_4: 0.9
> feature_b_4: 1.6
> feature_c_4: 8.2
> feature_a_186: 3.0
> feature_b_186: 2.1
> feature_c_186: 99.2
> 
> I’d like to pass in the subject IDs and make a function query (for sorting) from those, ending up with
> 
> sum(feature_x, feature_y, feature_a_4, feature_b_4, feature_c_4, feature_a_186, feature_b_186, feature c_186) desc
> 
> That would be used for the sort parameter.
> 
> Failing that, it would be nice so just pass in the parameterized portion, like this:
> 
> /handler?features=feature_a_4,feature_b_4,feature_c_4,feature_a_186,feature_b_186,feature c_186
> 
> Right now, I can’t even make a solrconfig.xml that will load. I’ve read everything I can find on params and function queries.
> 
> wunder
> Walter Underwood
> wunder@wunderwood.org
> http://observer.wunderwood.org/  (my blog)
> 
>