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 to handle spaces or :.... I digress.

I got it to work with {!switch}.

http://localhost:8983/solr/providersearchfull/select?wt=xml&state1=state:%22NY%22&fl=score&q=*:*&fq={!switch%20case=$state2%20default=$state1%20v=$state1}

If the user passes state1, it will not be empty and the default will pick
up all 50 states.

If the user does not pass state1, but passes state2, the case empty will
pick up since $state1 is empty, and it works.

http://localhost:8983/solr/providersearchfull/select?wt=xml&state2=state:%22CO%22&fl=score&q=*:*&fq={!switch%20case=$state2%20default=$state1%20v=$state1}

The only that that changes is if I set as a param state1 or state2.

If I send both state1 and state2, state1 takes precedence.

http://localhost:8983/solr/providersearchfull/select?wt=xml&state1=state:%22NY%22&state2=state:%22CO%22&fl=score&q=*:*&fq={!switch%20case=$state2%20default=$state1%20v=$state1}

Kinda interesting.

The query I sent earlier : {!orquery}query1,query2 will return query1 is it
is not empty, otherwise if query1 is empty it will run query2. That was the
code I sent last night.

I am going to send some more code, since I could not get TermQuery to work
like I have it in PayLoad. And need some help debugging that.

Thanks!



On Sun, Jan 3, 2016 at 11:32 AM, Erik Hatcher <erik.hatc...@gmail.com>
wrote:

> 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
>
>


-- 
Bill Bell
billnb...@gmail.com
cell 720-256-8076

Reply via email to