I haven’t fully digested this thread, but wanted to comment on this one.  
&param=$something doesn’t substitute.  Only “local” params (inside local param 
syntax curly brackets) do that.  If you want to substitute a raw parameter use 
curly brackets.  You could, in this example, use &tt=${state1}, I believe, and 
it would substitute.  Confusingly, local param curly brackets are _not_ the 
same as param substitution curly brackets.

I am skeptical that anything custom is needed for what you’re trying to do, but 
again I haven’t fully digested what’s going on here yet.  There is some param 
substitution and {!switch} voodoo in example/files that ships with Solr, and 
that might be helpful.  Check out how that works.  I’m in the polishing stages 
of a a collaborative blog post on example/files that will detail these tricks a 
bit - will publish that in the next few days.

—
Erik Hatcher, Senior Solutions Architect
http://www.lucidworks.com <http://www.lucidworks.com/>



> On Jan 1, 2016, at 4:15 PM, William Bell <billnb...@gmail.com> wrote:
> 
> Another weirdness:
> 
> http://localhost:8983/solr/providersearch/select?wt=json&state=state:CO&state1=state:NY&fl=*&q=*:*&tt=$state1&fq={!lucene%20v=$tt}
> 
> That does not return anything.
> 
> But if I set v=$state1 I get results.
> 
> Can I not set equivalent variables?
> 
> 
> 
> On Fri, Jan 1, 2016 at 2:07 PM, William Bell <billnb...@gmail.com> wrote:
> 
>> Example.
>> 
>> 
>> http://localhost:8983/solr/providersearch/select?wt=json&state=state:%22CO%22&state1=state:%22NY%22&fl=ss,score&q=*:*&fq={!lucene%20v=$state1}
>> <http://localhost:8983/solr/providersearch/select?wt=json&state=state:%22CO%22&state1=state:%22NY%22&fl=ss,score&q=*:*&fq=%7B!lucene%20v=$state1%7D>
>> 
>> This return 236,000
>> 
>> 
>> http://localhost:8983/solr/providersearch/select?wt=json&state=state:%22CO%22&state1=state:%22NY%22&fl=ss,score&q=*:*&fq={!lucene%20v=$state}
>> <http://localhost:8983/solr/providersearch/select?wt=json&state=state:%22CO%22&state1=state:%22NY%22&fl=ss,score&q=*:*&fq=%7B!lucene%20v=$state%7D>
>> 
>> This returns 10,000
>> 
>> I want to put an IF statement around which v to use.
>> 
>> 
>> 
>> 
>> 
>> 
>> On Fri, Jan 1, 2016 at 1:52 PM, William Bell <billnb...@gmail.com> wrote:
>> 
>>> Sure.
>>> 
>>> If the state:NY returns results filter by state:NY, if it does not, then
>>> use state:CO. If we have results in NY, use it, otherwise use CO.
>>> 
>>> OK?
>>> 
>>> On Fri, Jan 1, 2016 at 1:15 PM, Upayavira <u...@odoko.co.uk> wrote:
>>> 
>>>> 
>>>> 
>>>> On Thu, Dec 31, 2015, at 11:50 PM, William Bell wrote:
>>>>> We are getting weird results with if(exists(a),b,c). We are getting
>>>> b+c!!
>>>>> 
>>>>> 
>>>> http://localhost:8983/solr/providersearch/select?q=*:*&wt=json&state=state:%22CO%22&state1=state:%22NY%22&fq=if(exists(query($state1)),{!lucene%20v=$state1},{!lucene%20v=$state})
>>>> <http://localhost:8983/solr/providersearch/select?q=*:*&wt=json&state=state:%22CO%22&state1=state:%22NY%22&fq=if(exists(query($state1)),%7B!lucene%20v=$state1%7D,%7B!lucene%20v=$state%7D)>
>>>>> 
>>>>> I am getting NY and CO!
>>>>> 
>>>>> I only want $state1, which is NY.
>>>>> 
>>>>> Any other ways to craft this?
>>>> 
>>>> Does this work at all?
>>>> 
>>>> The if() function is a function query that can be used to sort, boost
>>>> and as calculated fields. I haven't seen them used in filtering.
>>>> 
>>>> Also, the query() function does *not* do a query, it just says "what
>>>> would this document score for this query?"
>>>> 
>>>> Can you describe in English what you are trying to do?
>>>> 
>>>> Upayavira
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> Bill Bell
>>> billnb...@gmail.com
>>> cell 720-256-8076
>>> 
>> 
>> 
>> 
>> --
>> Bill Bell
>> billnb...@gmail.com
>> cell 720-256-8076
>> 
> 
> 
> 
> -- 
> Bill Bell
> billnb...@gmail.com
> cell 720-256-8076

Reply via email to