Thanks for all the help, this was exactly the solution I needed, it returned 
all results containing both words, and single words. 

-----Original Message-----
From: "Thomas Joiner" <thomas.b.joi...@gmail.com>
Sent: Tuesday, September 21, 2010 2:53pm
To: solr-user@lucene.apache.org
Subject: Re: Searching solr with a two word query

I think what you want is a query like

all_text:(opening excellent) AND presentation_id:294 AND type:blob

which will require one of the all_text clauses to be true.

On Tue, Sep 21, 2010 at 12:20 PM, <n...@frameweld.com> wrote:

> Alright, this is making much more sense now, but there are still some
> problems. Removing the first AND in the query did solve a lot of things,
> beforehand I didn't know that it was requiring the word excel. Now I run the
> query as either of the two:
>
> opening excellent +presentation_id:294 +type:blob
> opening excellent presentation_id:294 AND type:blob
>
> I do get the results I want which have both words or either, BUT I get
> results that have neither. I think it may be grabbing results that belong to
> the specific presentation_id and if it's a blob type.
>
> What I want it to do is give me results that have both words, or one or the
> other.
>
> Thanks,
> - Noel
>
> -----Original Message-----
> From: "Tom Hill" <solr-l...@worldware.com>
> Sent: Monday, September 20, 2010 6:39pm
> To: solr-user@lucene.apache.org
> Subject: Re: Searching solr with a two word query
>
> It will probably be clearer if you don't use the pseudo-boolean
> operators, and just use + for required terms.
>
> If you look at your output from debug, you see your query becomes:
>
>     all_text:open +all_text:excel +presentation_id:294 +type:blob
>
> Note that "all_text:open" does not have a + sign, but
> "all_text:excel" has one. So "all_text:open" is not required, but
> "all_text:excel" is.
>
> I think this is because AND marks both of its operands as required.
> (which puts the + on +"all_text:excel"), but the open has no explicit
> op, so it uses OR, which marks that term as optional.
>
> What I would suggest you do is:
>
>    opening excellent +presentation_id:294 +type:blob
>
> Which is think is much clearer.
>
> I think you could also do
>   opening excellent presentation_id:294 AND type:blob
> but I think it's  non-obvious how the result will differ from
>   opening excellent AND presentation_id:294 AND type:blob
> So I wouldn't use either of the last two.
>
>
> Tom
> p.s. Not sure what is going on with the last lines of your debug
> output for the query. Is that really what shows up after presentation
> ID? I see Euro, hash mark, zero, semi-colon, and "H with stroke"
>
> <str name="parsedquery_toString">
> all_text:open +all_text:excel +presentation_id:€#0;Ħ +type:blob
> </str>
>
> On Mon, Sep 20, 2010 at 12:46 PM, <n...@frameweld.com> wrote:
> >
> > Say if I had a two word query that was "opening excellent", I would like
> it to return something like:
> >
> > opening excellent
> > opening
> > opening
> > opening
> > excellent
> > excellent
> > excellent
> >
> > Instead of:
> > opening excellent
> > excellent
> > excellent
> > excellent
> >
> > If I did a search, I would like the first word alone to also show up in
> the results, because currently my results show both words in one result and
> only the second word for the rest of the results. I've done a search on each
> word by itself, and there are results for them.
> >
> > Thanks.
> >
> > -----Original Message-----
> > From: "Erick Erickson" <erickerick...@gmail.com>
> > Sent: Monday, September 20, 2010 2:37pm
> > To: solr-user@lucene.apache.org
> > Subject: Re: Searching solr with a two word query
> >
> > I'm missing what you really want out of your query, your
> > phrase "either word as a single result" just isn't connecting
> > in my grey matter.. Could you give some example inputs and
> > outputs that demonstrates what you want?
> >
> > Best
> > Erick
> >
> > On Mon, Sep 20, 2010 at 11:41 AM, <n...@frameweld.com> wrote:
> >
> > > I noticed that my defaultOperator is "OR", and that does have an effect
> on
> > > what does come up. If I were to change that to and, it's an exact match
> to
> > > my query, but Im would like similar matches with either word as a
> single
> > > result. Is there another value I can use? Or maybe I should use another
> > > query parser?
> > >
> > > Thanks.
> > > - Noel
> > >
> > > -----Original Message-----
> > > From: "Erick Erickson" <erickerick...@gmail.com>
> > > Sent: Monday, September 20, 2010 10:05am
> > > To: solr-user@lucene.apache.org
> > > Subject: Re: Searching solr with a two word query
> > >
> > > Here's an excellent description of the Lucene query operators and how
> they
> > > differ from strict
> > > boolean logic:
> > > http://www.gossamer-threads.com/lists/lucene/java-user/47928
> > >
> > > <http://www.gossamer-threads.com/lists/lucene/java-user/47928>But the
> > > short
> > > form is that (and boy, doesn't the fact that the URL escaping spaces
> > > as '+', which is also a Lucene operator make looking at these
> interesting),
> > > is that the
> > > first term is essentially a SHOULD clause in a Lucene BooleanQuery and
> is
> > > matching your docs all by itself.
> > >
> > > HTH
> > > Erick
> > >
> > > On Mon, Sep 20, 2010 at 8:58 AM, <n...@frameweld.com> wrote:
> > >
> > > > Here is my raw query:
> > > >
> > >
> q=opening+excellent+AND+presentation_id%3A294+AND+type%3Ablob&version=1.3&
> > > > json.nl
> > > >
> > >
> =map&rows=100000&start=0&wt=xml&hl=true&hl.fl=text&hl.simple.pre=<span+class%3D"hl">&hl.simple.post=<%2Fspan>&hl.fragsize=0&hl.mergeContiguous=false&debugQuery=on
> > > >
> > > > and here is what I get on the debugQuery:
> > > > <lst name="debug">
> > > > −
> > > > <str name="rawquerystring">
> > > > opening excellent AND presentation_id:294 AND type:blob
> > > > </str>
> > > > −
> > > > <str name="querystring">
> > > > opening excellent AND presentation_id:294 AND type:blob
> > > > </str>
> > > > −
> > > > <str name="parsedquery">
> > > > all_text:open +all_text:excel +presentation_id:294 +type:blob
> > > > </str>
> > > > −
> > > > <str name="parsedquery_toString">
> > > > all_text:open +all_text:excel +presentation_id:€#0;Ħ +type:blob
> > > > </str>
> > > > −
> > > > <lst name="explain">
> > > > −
> > > > <str name="1435675blob">
> > > >
> > > > 3.1143723 = (MATCH) sum of:
> > > >  0.46052343 = (MATCH) weight(all_text:open in 4457), product of:
> > > >    0.5531408 = queryWeight(all_text:open), product of:
> > > >      5.3283896 = idf(docFreq=162, maxDocs=12359)
> > > >      0.10381013 = queryNorm
> > > >    0.8325609 = (MATCH) fieldWeight(all_text:open in 4457), product
> of:
> > > >      1.0 = tf(termFreq(all_text:open)=1)
> > > >      5.3283896 = idf(docFreq=162, maxDocs=12359)
> > > >      0.15625 = fieldNorm(field=all_text, doc=4457)
> > > >  0.74662465 = (MATCH) weight(all_text:excel in 4457), product of:
> > > >    0.7043054 = queryWeight(all_text:excel), product of:
> > > >      6.7845535 = idf(docFreq=37, maxDocs=12359)
> > > >      0.10381013 = queryNorm
> > > >    1.0600865 = (MATCH) fieldWeight(all_text:excel in 4457), product
> of:
> > > >      1.0 = tf(termFreq(all_text:excel)=1)
> > > >      6.7845535 = idf(docFreq=37, maxDocs=12359)
> > > >      0.15625 = fieldNorm(field=all_text, doc=4457)
> > > >  1.7987071 = (MATCH) weight(presentation_id:€#0;Ħ in 4457), product
> of:
> > > >    0.43211576 = queryWeight(presentation_id:€#0;Ħ), product of:
> > > >      4.1625586 = idf(docFreq=522, maxDocs=12359)
> > > >      0.10381013 = queryNorm
> > > >    4.1625586 = (MATCH) fieldWeight(presentation_id:€#0;Ħ in 4457),
> > > product
> > > > of:
> > > >      1.0 = tf(termFreq(presentation_id:€#0;Ħ)=1)
> > > >      4.1625586 = idf(docFreq=522, maxDocs=12359)
> > > >      1.0 = fieldNorm(field=presentation_id, doc=4457)
> > > >  0.108517066 = (MATCH) weight(type:blob in 4457), product of:
> > > >    0.10613751 = queryWeight(type:blob), product of:
> > > >      1.0224196 = idf(docFreq=12084, maxDocs=12359)
> > > >      0.10381013 = queryNorm
> > > >    1.0224196 = (MATCH) fieldWeight(type:blob in 4457), product of:
> > > >      1.0 = tf(termFreq(type:blob)=1)
> > > >      1.0224196 = idf(docFreq=12084, maxDocs=12359)
> > > >      1.0 = fieldNorm(field=type, doc=4457)
> > > > </str>
> > > > −
> > > > <str name="1436129blob">
> > > >
> > > > 2.06395 = (MATCH) product of:
> > > >  2.7519336 = (MATCH) sum of:
> > > >    0.84470934 = (MATCH) weight(all_text:excel in 4911), product of:
> > > >      0.7043054 = queryWeight(all_text:excel), product of:
> > > >        6.7845535 = idf(docFreq=37, maxDocs=12359)
> > > >        0.10381013 = queryNorm
> > > >      1.199351 = (MATCH) fieldWeight(all_text:excel in 4911), product
> of:
> > > >        1.4142135 = tf(termFreq(all_text:excel)=2)
> > > >        6.7845535 = idf(docFreq=37, maxDocs=12359)
> > > >        0.125 = fieldNorm(field=all_text, doc=4911)
> > > >    1.7987071 = (MATCH) weight(presentation_id:€#0;Ħ in 4911), product
> of:
> > > >      0.43211576 = queryWeight(presentation_id:€#0;Ħ), product of:
> > > >        4.1625586 = idf(docFreq=522, maxDocs=12359)
> > > >        0.10381013 = queryNorm
> > > >      4.1625586 = (MATCH) fieldWeight(presentation_id:€#0;Ħ in 4911),
> > > > product of:
> > > >        1.0 = tf(termFreq(presentation_id:€#0;Ħ)=1)
> > > >        4.1625586 = idf(docFreq=522, maxDocs=12359)
> > > >        1.0 = fieldNorm(field=presentation_id, doc=4911)
> > > >    0.108517066 = (MATCH) weight(type:blob in 4911), product of:
> > > >      0.10613751 = queryWeight(type:blob), product of:
> > > >        1.0224196 = idf(docFreq=12084, maxDocs=12359)
> > > >        0.10381013 = queryNorm
> > > >      1.0224196 = (MATCH) fieldWeight(type:blob in 4911), product of:
> > > >        1.0 = tf(termFreq(type:blob)=1)
> > > >        1.0224196 = idf(docFreq=12084, maxDocs=12359)
> > > >        1.0 = fieldNorm(field=type, doc=4911)
> > > >  0.75 = coord(3/4)
> > > > </str>
> > > > −
> > > > <str name="1435686blob">
> > > >
> > > > 1.9903867 = (MATCH) product of:
> > > >  2.653849 = (MATCH) sum of:
> > > >    0.74662465 = (MATCH) weight(all_text:excel in 4468), product of:
> > > >      0.7043054 = queryWeight(all_text:excel), product of:
> > > >        6.7845535 = idf(docFreq=37, maxDocs=12359)
> > > >        0.10381013 = queryNorm
> > > >      1.0600865 = (MATCH) fieldWeight(all_text:excel in 4468), product
> of:
> > > >        1.0 = tf(termFreq(all_text:excel)=1)
> > > >        6.7845535 = idf(docFreq=37, maxDocs=12359)
> > > >        0.15625 = fieldNorm(field=all_text, doc=4468)
> > > >    1.7987071 = (MATCH) weight(presentation_id:€#0;Ħ in 4468), product
> of:
> > > >      0.43211576 = queryWeight(presentation_id:€#0;Ħ), product of:
> > > >        4.1625586 = idf(docFreq=522, maxDocs=12359)
> > > >        0.10381013 = queryNorm
> > > >      4.1625586 = (MATCH) fieldWeight(presentation_id:€#0;Ħ in 4468),
> > > > product of:
> > > >        1.0 = tf(termFreq(presentation_id:€#0;Ħ)=1)
> > > >        4.1625586 = idf(docFreq=522, maxDocs=12359)
> > > >        1.0 = fieldNorm(field=presentation_id, doc=4468)
> > > >    0.108517066 = (MATCH) weight(type:blob in 4468), product of:
> > > >      0.10613751 = queryWeight(type:blob), product of:
> > > >        1.0224196 = idf(docFreq=12084, maxDocs=12359)
> > > >        0.10381013 = queryNorm
> > > >      1.0224196 = (MATCH) fieldWeight(type:blob in 4468), product of:
> > > >        1.0 = tf(termFreq(type:blob)=1)
> > > >        1.0224196 = idf(docFreq=12084, maxDocs=12359)
> > > >        1.0 = fieldNorm(field=type, doc=4468)
> > > >  0.75 = coord(3/4)
> > > > </str>
> > > > −
> > > > <str name="1435689blob">
> > > >
> > > > 1.9903867 = (MATCH) product of:
> > > >  2.653849 = (MATCH) sum of:
> > > >    0.74662465 = (MATCH) weight(all_text:excel in 4471), product of:
> > > >      0.7043054 = queryWeight(all_text:excel), product of:
> > > >        6.7845535 = idf(docFreq=37, maxDocs=12359)
> > > >        0.10381013 = queryNorm
> > > >      1.0600865 = (MATCH) fieldWeight(all_text:excel in 4471), product
> of:
> > > >        1.0 = tf(termFreq(all_text:excel)=1)
> > > >        6.7845535 = idf(docFreq=37, maxDocs=12359)
> > > >        0.15625 = fieldNorm(field=all_text, doc=4471)
> > > >    1.7987071 = (MATCH) weight(presentation_id:€#0;Ħ in 4471), product
> of:
> > > >      0.43211576 = queryWeight(presentation_id:€#0;Ħ), product of:
> > > >        4.1625586 = idf(docFreq=522, maxDocs=12359)
> > > >        0.10381013 = queryNorm
> > > >      4.1625586 = (MATCH) fieldWeight(presentation_id:€#0;Ħ in 4471),
> > > > product of:
> > > >        1.0 = tf(termFreq(presentation_id:€#0;Ħ)=1)
> > > >        4.1625586 = idf(docFreq=522, maxDocs=12359)
> > > >        1.0 = fieldNorm(field=presentation_id, doc=4471)
> > > >    0.108517066 = (MATCH) weight(type:blob in 4471), product of:
> > > >      0.10613751 = queryWeight(type:blob), product of:
> > > >        1.0224196 = idf(docFreq=12084, maxDocs=12359)
> > > >        0.10381013 = queryNorm
> > > >      1.0224196 = (MATCH) fieldWeight(type:blob in 4471), product of:
> > > >        1.0 = tf(termFreq(type:blob)=1)
> > > >        1.0224196 = idf(docFreq=12084, maxDocs=12359)
> > > >        1.0 = fieldNorm(field=type, doc=4471)
> > > >  0.75 = coord(3/4)
> > > > </str>
> > > > −
> > > > <str name="1435690blob">
> > > >
> > > > 1.9903867 = (MATCH) product of:
> > > >  2.653849 = (MATCH) sum of:
> > > >    0.74662465 = (MATCH) weight(all_text:excel in 4472), product of:
> > > >      0.7043054 = queryWeight(all_text:excel), product of:
> > > >        6.7845535 = idf(docFreq=37, maxDocs=12359)
> > > >        0.10381013 = queryNorm
> > > >      1.0600865 = (MATCH) fieldWeight(all_text:excel in 4472), product
> of:
> > > >        1.0 = tf(termFreq(all_text:excel)=1)
> > > >        6.7845535 = idf(docFreq=37, maxDocs=12359)
> > > >        0.15625 = fieldNorm(field=all_text, doc=4472)
> > > >    1.7987071 = (MATCH) weight(presentation_id:€#0;Ħ in 4472), product
> of:
> > > >      0.43211576 = queryWeight(presentation_id:€#0;Ħ), product of:
> > > >        4.1625586 = idf(docFreq=522, maxDocs=12359)
> > > >        0.10381013 = queryNorm
> > > >      4.1625586 = (MATCH) fieldWeight(presentation_id:€#0;Ħ in 4472),
> > > > product of:
> > > >        1.0 = tf(termFreq(presentation_id:€#0;Ħ)=1)
> > > >        4.1625586 = idf(docFreq=522, maxDocs=12359)
> > > >        1.0 = fieldNorm(field=presentation_id, doc=4472)
> > > >    0.108517066 = (MATCH) weight(type:blob in 4472), product of:
> > > >      0.10613751 = queryWeight(type:blob), product of:
> > > >        1.0224196 = idf(docFreq=12084, maxDocs=12359)
> > > >        0.10381013 = queryNorm
> > > >      1.0224196 = (MATCH) fieldWeight(type:blob in 4472), product of:
> > > >        1.0 = tf(termFreq(type:blob)=1)
> > > >        1.0224196 = idf(docFreq=12084, maxDocs=12359)
> > > >        1.0 = fieldNorm(field=type, doc=4472)
> > > >  0.75 = coord(3/4)
> > > > </str>
> > > > −
> > > > <str name="1436096blob">
> > > >
> > > > 1.9903867 = (MATCH) product of:
> > > >  2.653849 = (MATCH) sum of:
> > > >    0.74662465 = (MATCH) weight(all_text:excel in 4878), product of:
> > > >      0.7043054 = queryWeight(all_text:excel), product of:
> > > >        6.7845535 = idf(docFreq=37, maxDocs=12359)
> > > >        0.10381013 = queryNorm
> > > >      1.0600865 = (MATCH) fieldWeight(all_text:excel in 4878), product
> of:
> > > >        1.0 = tf(termFreq(all_text:excel)=1)
> > > >        6.7845535 = idf(docFreq=37, maxDocs=12359)
> > > >        0.15625 = fieldNorm(field=all_text, doc=4878)
> > > >    1.7987071 = (MATCH) weight(presentation_id:€#0;Ħ in 4878), product
> of:
> > > >      0.43211576 = queryWeight(presentation_id:€#0;Ħ), product of:
> > > >        4.1625586 = idf(docFreq=522, maxDocs=12359)
> > > >        0.10381013 = queryNorm
> > > >      4.1625586 = (MATCH) fieldWeight(presentation_id:€#0;Ħ in 4878),
> > > > product of:
> > > >        1.0 = tf(termFreq(presentation_id:€#0;Ħ)=1)
> > > >        4.1625586 = idf(docFreq=522, maxDocs=12359)
> > > >        1.0 = fieldNorm(field=presentation_id, doc=4878)
> > > >    0.108517066 = (MATCH) weight(type:blob in 4878), product of:
> > > >      0.10613751 = queryWeight(type:blob), product of:
> > > >        1.0224196 = idf(docFreq=12084, maxDocs=12359)
> > > >        0.10381013 = queryNorm
> > > >      1.0224196 = (MATCH) fieldWeight(type:blob in 4878), product of:
> > > >        1.0 = tf(termFreq(type:blob)=1)
> > > >        1.0224196 = idf(docFreq=12084, maxDocs=12359)
> > > >        1.0 = fieldNorm(field=type, doc=4878)
> > > >  0.75 = coord(3/4)
> > > > </str>
> > > > </lst>
> > > > <str name="QParser">LuceneQParser</str>
> > > > −
> > > > <lst name="timing">
> > > > <double name="time">138.0</double>
> > > > −
> > > > <lst name="prepare">
> > > > <double name="time">6.0</double>
> > > > −
> > > > <lst name="org.apache.solr.handler.component.QueryComponent">
> > > > <double name="time">6.0</double>
> > > > </lst>
> > > > −
> > > > <lst name="org.apache.solr.handler.component.FacetComponent">
> > > > <double name="time">0.0</double>
> > > > </lst>
> > > > −
> > > > <lst name="org.apache.solr.handler.component.MoreLikeThisComponent">
> > > > <double name="time">0.0</double>
> > > > </lst>
> > > > −
> > > > <lst name="org.apache.solr.handler.component.HighlightComponent">
> > > > <double name="time">0.0</double>
> > > > </lst>
> > > > −
> > > > <lst name="org.apache.solr.handler.component.StatsComponent">
> > > > <double name="time">0.0</double>
> > > > </lst>
> > > > −
> > > > <lst name="org.apache.solr.handler.component.DebugComponent">
> > > > <double name="time">0.0</double>
> > > > </lst>
> > > > </lst>
> > > > −
> > > > <lst name="process">
> > > > <double name="time">132.0</double>
> > > > −
> > > > <lst name="org.apache.solr.handler.component.QueryComponent">
> > > > <double name="time">10.0</double>
> > > > </lst>
> > > > −
> > > > <lst name="org.apache.solr.handler.component.FacetComponent">
> > > > <double name="time">0.0</double>
> > > > </lst>
> > > > −
> > > > <lst name="org.apache.solr.handler.component.MoreLikeThisComponent">
> > > > <double name="time">0.0</double>
> > > > </lst>
> > > > −
> > > > <lst name="org.apache.solr.handler.component.HighlightComponent">
> > > > <double name="time">62.0</double>
> > > > </lst>
> > > > −
> > > > <lst name="org.apache.solr.handler.component.StatsComponent">
> > > > <double name="time">0.0</double>
> > > > </lst>
> > > > −
> > > > <lst name="org.apache.solr.handler.component.DebugComponent">
> > > > <double name="time">60.0</double>
> > > > </lst>
> > > > </lst>
> > > > </lst>
> > > > </lst>
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: "Erick Erickson" <erickerick...@gmail.com>
> > > > Sent: Friday, September 17, 2010 8:00pm
> > > > To: solr-user@lucene.apache.org
> > > > Subject: Re: Searching solr with a two word query
> > > >
> > > > I suspect that you're seeing the default query operator
> > > > in action, as an OR. We could tell more if you posted
> > > > the results of your query with &debugQuery=on
> > > >
> > > > Best
> > > > Erick
> > > >
> > > > On Fri, Sep 17, 2010 at 3:58 PM, <n...@frameweld.com> wrote:
> > > >
> > > > > For some reason, when I run a query that has only two words in it,
> I
> > > get
> > > > > back repeating results of the last word. If I were to search for
> > > > something
> > > > > like "good tonight", I'll get results like:
> > > > >
> > > > > good tonight
> > > > > tonight good
> > > > > tonight
> > > > > tonight
> > > > > tonight
> > > > > tonight
> > > > > tonight
> > > > > tonight
> > > > >
> > > > >
> > > > > Basically, the first word if it was searched alone does have
> results,
> > > but
> > > > > it doesn't appear anywhere else in the results unless if it were
> there
> > > > with
> > > > > the second word. I'm not exactly what this has to do with, help
> would
> > > be
> > > > > appreciated.
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> >
> >
>
>
>


Reply via email to