You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Jon Drukman <js...@cluttered.com> on 2010/11/12 19:22:21 UTC
Searching with AND + OR and spaces
I want to search two fields for the phrase Call Of Duty. I tried this:
(title:"Call of Duty" OR subhead:"Call of Duty")
No matches, despite the fact that there are many documents that should match.
So I left out the quotes, and it seems to work. But now when I try doing things
like
title:Call of Duty OR subhead:Call of Duty AND type:4
I get a lot of things like "called it!" and "i'm taking calls" but call of duty
doesn't surface.
How can I get what I want?
-jsd-
Re: Searching with AND + OR and spaces
Posted by Tomas Fernandez Lobbe <to...@yahoo.com.ar>.
Hi Jon, for the first query:
title:"Call of Duty" OR subhead:"Call of Duty"
If you are sure that you have documents with the same phrase, make sure you
don't have a problem with stop words and with token positions. I recommend you
to check the analysis page at the Solr admin. pay special attention to the
"enablePositionIncrements" attribute of the StopFilterFactory which defaults to
false.
(http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.StopFilterFactory).
for your second query:
title:Call of Duty OR subhead:Call of Duty AND type:4
make sure that you add parentheses like:
title:(Call of Duty) OR subhead:(Call of Duty) AND type:4
otherwise it will be translated to the query (supposing you have OR as your
default parameter):
title:Call OR your_default_field:of OR your_default_field:Duty OR subhead:Call
OR your_default_field:of OR your_default_field:Duty AND type:4
Tomás
________________________________
De: Jon Drukman <js...@cluttered.com>
Para: solr-user@lucene.apache.org
Enviado: viernes, 12 de noviembre, 2010 15:22:21
Asunto: Searching with AND + OR and spaces
I want to search two fields for the phrase Call Of Duty. I tried this:
(title:"Call of Duty" OR subhead:"Call of Duty")
No matches, despite the fact that there are many documents that should match.
So I left out the quotes, and it seems to work. But now when I try doing things
like
title:Call of Duty OR subhead:Call of Duty AND type:4
I get a lot of things like "called it!" and "i'm taking calls" but call of duty
doesn't surface.
How can I get what I want?
-jsd-
Re: Searching with AND + OR and spaces
Posted by Imran <im...@gmail.com>.
To get a more precise result on exact matches of your terms, how about
having another a string type field for title and subhead. And use dismax to
boost the string type fields more than the text type fields.
Cheers
-- Imran
On Fri, Nov 12, 2010 at 6:56 PM, Jon Drukman <js...@cluttered.com> wrote:
> Ahmet Arslan <iorixxx <at> yahoo.com> writes:
>
> >
> > > (title:"Call of Duty" OR subhead:"Call of Duty")
> > >
> > > No matches, despite the fact that there are many documents
> > > that should match.
> >
> > Field types of title and subhead are important here. Do you use
> stopwordfilterfactory with enable
> > position increments?
>
> <field name="title" type="text" indexed="true" stored="true"/>
> <field name="subhead" type="text" indexed="true" stored="true"/>
>
> text is the default that comes with schema.xml, it has the enable position
> increments stopwordfilterfactory.
>
> > What is you solr version?
>
> 1.4
>
>
> > > So I left out the quotes, and it seems to work. But
> > > now when I try doing things
> > > like
> > >
> > > title:Call of Duty OR subhead:Call of Duty AND type:4
> > >
> >
> > Try using parenthesis.
> > title:(Call of Duty) OR subhead:(Call of Duty) AND type:4
>
> that seems to work a lot better, thanks!!
>
>
Re: Searching with AND + OR and spaces
Posted by Jon Drukman <js...@cluttered.com>.
Ahmet Arslan <iorixxx <at> yahoo.com> writes:
>
> > (title:"Call of Duty" OR subhead:"Call of Duty")
> >
> > No matches, despite the fact that there are many documents
> > that should match.
>
> Field types of title and subhead are important here. Do you use
stopwordfilterfactory with enable
> position increments?
<field name="title" type="text" indexed="true" stored="true"/>
<field name="subhead" type="text" indexed="true" stored="true"/>
text is the default that comes with schema.xml, it has the enable position
increments stopwordfilterfactory.
> What is you solr version?
1.4
> > So I left out the quotes, and it seems to work. But
> > now when I try doing things
> > like
> >
> > title:Call of Duty OR subhead:Call of Duty AND type:4
> >
>
> Try using parenthesis.
> title:(Call of Duty) OR subhead:(Call of Duty) AND type:4
that seems to work a lot better, thanks!!
Re: Searching with AND + OR and spaces
Posted by Ahmet Arslan <io...@yahoo.com>.
> (title:"Call of Duty" OR subhead:"Call of Duty")
>
> No matches, despite the fact that there are many documents
> that should match.
Field types of title and subhead are important here. Do you use stopwordfilterfactory with enable position increments?
What is you solr version?
> So I left out the quotes, and it seems to work. But
> now when I try doing things
> like
>
> title:Call of Duty OR subhead:Call of Duty AND type:4
>
Try using parenthesis.
title:(Call of Duty) OR subhead:(Call of Duty) AND type:4