type:value AND (name:america^1+name:state^1+name:united^1)

but in reality what you want to do is use the fq parameter with type:value

On Thu, Aug 10, 2017 at 4:36 PM, OTH <omer.t....@gmail.com> wrote:

> Hello,
>
> I have the following use case:
>
> I have two fields (among others); one is 'name' and the other is 'type'.
>  'Name' is the field I need to search, whereas, with 'type', I need to make
> sure that it has a certain value, depending on the situation.  Often, when
> I search the 'name' field, the search query would have multiple tokens.
> Furthermore, each query token needs to have a scoring weight attached to
> it.
>
> However, I'm unable to figure out the syntax which would allow all these
> things to happen.
>
> For example, if I use the following query:
> select?q=type:value+AND+name:america^1+name:state^1+name:united^1
> It would only return documents where 'name' includes the token 'america'
> (and where type==value).  It will totally ignore
> "+name:state^1+name:united^1", it seems.
>
> This does not happen if I omit "type:value+AND+".  So, with the following
> query:
> select?q=name:america^1+name:state^1+name:united^1
> It returns all documents which contain any of the three tokens {america,
> state, united}; which is what I need.  However, it also returns documents
> where type != value; which I can't have.
>
> If I put "type:value" at the end of the query command, like so:
> select?q=name:america^1+name:state^1+name:united^1+AND+type:value
> In this case, it will only return documents which contain the "united"
> token in the name field (and where type==value).  Again, it will totally
> ignore "name:america^1+name:state^1", it seems.
>
> I tried putting an "AND" between everything, like so:
> select?q=type:value+AND+name:america^1+AND+name:state^1+AND+name:united^1
> But this, of course, would only return documents which contain all the
> tokens {america, state, united}; whereas I need all documents which contain
> any of those tokens.
>
>
> If anyone could help me out with how this could be done / what the correct
> syntax would be, that would be a huge help.
>
> Much thanks
> Omer
>

Reply via email to