<str name="fq">name_long:"paisley, ian"</str>
<str name="q">
*:* OR (constituencies:(ian paisley) OR label:(ian paisley) OR office:(ian
paisley))
</str>
</lst>

Does actually give me incorrect results for other queries. :(


On Thu, Jan 10, 2013 at 7:42 PM, Michael Jones <michaelj...@gmail.com>wrote:

> My fields are
>
> <field name="id" type="string" indexed="true" stored="true"
> required="true" multiValued="false" />
> <field name="name" type="text_general" indexed="true" stored="true"
> multiValued="true"/>
> <field name="name_long" type="string" indexed="true" stored="true"
> multiValued="true"/>
> <field name="type" type="string" indexed="true" stored="true"
> multiValued="true"/>
> <field name="label" type="text_general" indexed="true" stored="true"
> multiValued="true"/>
> <field name="label_long" type="string" indexed="true" stored="true"
> multiValued="true"/>
> <field name="date" type="date" indexed="true" stored="true"
> multiValued="true"/>
> <field name="constituencies" type="string" indexed="true" stored="true"
> multiValued="true"/>
> <field name="office" type="string" indexed="true" stored="true"
> multiValued="true"/>
>
> And doing
>
> <str name="fq">name_long:"paisley, ian"</str>
> <str name="q">
> (constituencies:(+ian +paisley) OR label:(+ian +paisley) OR office:(+ian
> +paisley))
> </str>
> </lst>
>
> And
>
> <str name="fq">name_long:"paisley, ian"</str>
> <str name="q">
> (constituencies:(ian AND paisley) OR label:(ian AND paisley) OR
> office:(ian AND paisley))
> </str>
>
> return zero results. However, if I do
>
> <str name="fq">name_long:"paisley, ian"</str>
> <str name="q">
> *:* OR (constituencies:(ian paisley) OR label:(ian paisley) OR office:(ian
> paisley))
> </str>
> </lst>
>
> I do get results, but I'm not sure if putting *:* at the start will break
> things down the line with other queries.
>
>
> On Thu, Jan 10, 2013 at 6:36 PM, Dyer, James <james.d...@ingramcontent.com
> > wrote:
>
>> If the fields you're querying are of type String (1 token), then you need
>> to escape the whitespace with a backslash, like this:
>>
>> label:ian\ paisley
>>
>>
>> If they are of type Text (multiple tokens), sometimes you need to
>> explicitly insert "AND" between each token, either with:
>>
>> label:(ian AND paisley)
>>
>> or
>>
>> label:(+ian +paisley)
>>
>> I think this is the case with edismax, which somewhat supports boolean
>> queries but with caveats...
>>
>> You can also turn debugQuery on to figure out why things are not matching.
>>
>> James Dyer
>> E-Commerce Systems
>> Ingram Content Group
>> (615) 213-4311
>>
>>
>> -----Original Message-----
>> From: Michael Jones [mailto:michaelj...@gmail.com]
>> Sent: Thursday, January 10, 2013 11:48 AM
>> To: solr-user@lucene.apache.org
>> Subject: Re: OR query
>>
>> I've tried both ways and I still get zero results with this.
>> Even though name_long:"paisley, ian" will return results.
>>
>> <str name="fq">name_long:"paisley, ian"</str>
>> <str name="q">
>> (constituencies:(ian paisley) OR label:(ian paisley) OR office:(ian
>> paisley))
>> </str>
>>
>>
>> On Thu, Jan 10, 2013 at 3:27 PM, Jack Krupansky <j...@basetechnology.com
>> >wrote:
>>
>> > You're using query and filter query backwards - the query is what you
>> are
>> > looking for (the OR), while the filter query is the constraint on the
>> query
>> > - the drill down.
>> >
>> >
>> > -- Jack Krupansky
>> >
>> > -----Original Message----- From: Michael Jones
>> > Sent: Thursday, January 10, 2013 7:38 AM
>> > To: solr-user@lucene.apache.org
>> > Subject: Re: OR query
>> >
>> >
>> > Thanks, I've tried doing
>> >
>> > <lst name="params">
>> > <str name="wt">xml</str>
>> > <str name="fq">
>> > (constituencies:(ian paisley) OR label:(ian paisley) OR office:(ian
>> > paisley))
>> > </str>
>> > <str name="q">name_long:"paisley, ian"</str>
>> > </lst>
>> > </lst>
>> > <result name="response" numFound="0" start="0"/>
>> >
>> > and
>> >
>> > <str name="fq">+ian +paisley "paisley, ian"</str>
>> > <str name="q">name_long:"paisley, ian"</str>
>> >
>> > But neither return any results
>> >
>> >
>> > On Thu, Jan 10, 2013 at 11:53 AM, Jack Krupansky <
>> j...@basetechnology.com>
>> > **wrote:
>> >
>> >  Use filter queries to filter or drill down:
>> >>
>> >> http://wiki.apache.org/solr/****CommonQueryParameters#fq<
>> http://wiki.apache.org/solr/**CommonQueryParameters#fq>
>> >> <http:**//wiki.apache.org/solr/**CommonQueryParameters#fq<
>> http://wiki.apache.org/solr/CommonQueryParameters#fq>
>> >> >
>> >>
>> >>
>> >> Also consider using dismax/edismax queries, which are designed to
>> match on
>> >> any of multiple fields.
>> >>
>> >> Also be careful to put a space between each left parenthesis and field
>> >> name since there is a known bug that causes such queries to fail.
>> >>
>> >> -- Jack Krupansky
>> >>
>> >> -----Original Message----- From: Michael Jones
>> >> Sent: Thursday, January 10, 2013 6:24 AM
>> >> To: solr-user@lucene.apache.org
>> >> Subject: OR query
>> >>
>> >>
>> >> Hi,
>> >>
>> >> I have a query that searches through every field to find the text
>> 'london'
>> >>
>> >> (constituencies:(london) OR label:(london) OR name:(london) OR
>> >> office:(london))
>> >>
>> >> Which works fine, but when I want to filter my results. Say I want to
>> >> filter down to constituencies that exactly match 'london', but also
>> search
>> >> the rest of the fields to make sure that the keyword still matches
>> >> elsewhere
>> >>
>> >> (label:(london) OR name:(london) OR office:(london)) AND
>> >> (constituencies:"london")
>> >>
>> >> Sometimes I get zero results because label, name and office don't have
>> the
>> >> keyword 'london', but I know constituencies does, so results should be
>> >
>> >> 0.
>> >> But if try:
>> >>
>> >> (constituencies:(london) OR name:(london) OR office:(london)) AND
>> >> (label:"london")
>> >>
>> >> returns results because constituencies is in one of the OR queries.
>> >>
>> >> Is there a way to say if none of the OR quires bring back a result at
>> >> least
>> >> search the AND?
>> >>
>> >> Thanks
>> >>
>> >>
>> >
>>
>>
>

Reply via email to