Maybe we can add function value on a switch? fq={!switch case.gt.0 default=$state func=len($state1)}</str>
We could add: gt, lt, eq, ge, le ? gt: greater than lt: less than eq: equal ge: greater than or equal le: less than or equal ?? On Fri, Jan 1, 2016 at 2:25 PM, William Bell <billnb...@gmail.com> wrote: > This all started with me trying to use {!switch} to indicate with CO or NY > to use. if we pass state1, that is supposed to take precedence, but if > nothing is returned, then use state.... Make sense now? > > I could not find a way to check for strlen($state1). Which is what I want > in the case statement. This just does not work... > Something like the following is what I am trying to do: > > > fq={!switch case."anything"=$state1 > default=$state > v=$state1}</str> > > So I tried the following to set all 50 states: > > > fq={!switch case.all='*:*' > case.CO='state:CO' > case.NY='state:NY' > v=$state1}</str> > > > Obviously Oregon (OR!) is an issue, and it won't work at all plus > > > > On Fri, Jan 1, 2016 at 2: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} >> <http://localhost:8983/solr/providersearch/select?wt=json&state=state:CO&state1=state:NY&fl=*&q=*:*&tt=$state1&fq=%7B!lucene%20v=$tt%7D> >> >> 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 >> > > > > -- > Bill Bell > billnb...@gmail.com > cell 720-256-8076 > -- Bill Bell billnb...@gmail.com cell 720-256-8076