lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Jones <michaelj...@gmail.com>
Subject Re: OR query
Date Thu, 10 Jan 2013 20:10:55 GMT
Ok, I think I see where the problem is coming from.

I do a search for 'ian paisley' over all four fields and get 900 results.
And in my returned facets there is 'paisley, ian' in the name facet. If you
only search for his name, name_long:"paisley, ian" - you get 200 results.
But if someone does a free text search over the four fields then tries to
filter by name then they get zero results because he doesn't exist where
his name and label match in the same record.



On Thu, Jan 10, 2013 at 7:56 PM, Dyer, James
<James.Dyer@ingramcontent.com>wrote:

> I notice here that both "constituencies" and "office" are type "string",
> so these probably have only 1 token.  In this case, you need to search with
> the whitespace escaped with a backslash.
>
> Besides this, I'm not entirely sure what more to tell you.  You're going
> to have to verify that some documents with 'name_long:"paisley, ian"' also
> contain that name in either "constituencies", "label", or "office".  It
> could be that things aren't being indexed as you think.
>
> James Dyer
> E-Commerce Systems
> Ingram Content Group
> (615) 213-4311
>
>
> -----Original Message-----
> From: Michael Jones [mailto:michaelj491@gmail.com]
> Sent: Thursday, January 10, 2013 1:43 PM
> To: solr-user@lucene.apache.org
> Subject: Re: OR query
>
> 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.Dyer@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:michaelj491@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 <jack@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 <
> > jack@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
> > >>
> > >>
> > >
> >
> >
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message