Re: Issue with if() statement

2016-01-03 Thread William Bell
Thanks that indeed works tt=${state1}. But that was just a passing question. I see an empty "*case*", "default" and a "case.VAL". I think I have anything I need. After rereading. We might want to add to "case.VAL" something like "case.'state:CO'" with a single quote. Right now it does not appear t

Re: Issue with if() statement

2016-01-03 Thread Erik Hatcher
I haven’t fully digested this thread, but wanted to comment on this one. ¶m=$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 be

Re: Issue with if() statement

2016-01-03 Thread William Bell
OK. I was able to get it to work by looking at {!switch} code. I had a heck of a time trying to get parse() to work as a separate class. q.add(new TermQuery(new Term("state", "CO"), Occur.MUST); return q; That never did anything. Here is some code that worked... http://localhost:8983/solr/provi

Re: Issue with if() statement

2016-01-02 Thread Upayavira
Hrmph. I've got an Ant based codebase for building custom components against Solr. I've been asked on numerous occasions to publish this codebase. It is now at: https://github.com/upayavira/custom-solr-components There's no sample code in there yet. I'll see if I can stick one in there now, but I

Re: Issue with if() statement

2016-01-01 Thread William Bell
Sample code for a simple query parser? On Fri, Jan 1, 2016 at 3:08 PM, Upayavira wrote: > You've got to think of what the queries will be that you produce under > the bonnet - what you are talking about is either a (!func} or a > {!frange} query - both of which are inefficient as they must scan

Re: Issue with if() statement

2016-01-01 Thread Upayavira
You've got to think of what the queries will be that you produce under the bonnet - what you are talking about is either a (!func} or a {!frange} query - both of which are inefficient as they must scan the entire resultset. However, what you're trying to do is evaluate the length of the *input val

Re: Issue with if() statement

2016-01-01 Thread William Bell
Also ne: not equal. This is like KSH. On Fri, Jan 1, 2016 at 2:40 PM, William Bell wrote: > Forgot last bit: > > fq={!switch case.gt.0=$state1 > default=$state > func=len($state1)} > > > On Fri, Jan 1, 2016 at 2:39 PM, William Bell wrot

Re: Issue with if() statement

2016-01-01 Thread William Bell
Forgot last bit: fq={!switch case.gt.0=$state1 default=$state func=len($state1)} On Fri, Jan 1, 2016 at 2:39 PM, William Bell wrote: > Maybe we can add function value on a switch? > > fq={!switch case.gt.0 >

Re: Issue with if() statement

2016-01-01 Thread William Bell
Maybe we can add function value on a switch? fq={!switch case.gt.0 default=$state func=len($state1)} 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

Re: Issue with if() statement

2016-01-01 Thread William Bell
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.

Re: Issue with if() statement

2016-01-01 Thread Upayavira
I'm afraid I cannot see how this can be done - at least without coding. Basically, when your filter is being evaluated, you want to make use of knowledge of the main query - for normal queries, that isn't possible, as they are created independently. You could use potentially use a "post filter" i

Re: Issue with if() statement

2016-01-01 Thread William Bell
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, Willi

Re: Issue with if() statement

2016-01-01 Thread William Bell
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} 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={!l

Re: Issue with if() statement

2016-01-01 Thread William Bell
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 wrote: > > > On Thu, Dec 31, 2015, at 11:50 PM, William Bell wrote: > > We are getting weird results wi

Re: Issue with if() statement

2016-01-01 Thread Upayavira
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},{!lu

Re: Issue with if() statement

2015-12-31 Thread Jack Krupansky
You can't have spaces in a function query - the %20 will get expanded to a space (just as a "+" would.) And fq is "filter query" anyway, not "function query". Try: fq={!func}... Not sure what the solution to those embedded spaces is, but you probably need function queries there as well. -- Jack

Re: Issue with if() statement

2015-12-31 Thread billnbell
Solr 5.3.1 Bill Bell Sent from mobile > On Dec 31, 2015, at 4: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(que