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 Tim Hearn <ti...@gmail.com> on 2014/11/03 18:00:47 UTC

Cannot use Phrase Queries in eDisMax and filtering

I am writing a search bar application with Solr which I'd like to have the
following two features:

phrase matching for user queries - results which match user phrase are
boosted.

Field faceting based on 'tags' field.

When I execute this query:

q=steve jobs&
fq=storeid:527bd613e4b0564cc755460a&
sort=score desc&
start=50&
rows=2&
fl=*,score&
qt=/query&
defType=edismax&
pf=concept_name^15 note_text^5 file_text^2.5&
pf3=1&
pf2=1&
ps=1&
group=true&
group.field=conceptid&
group.limit=10&
group.ngroups=true

The phrase boosting feature operates correctly and boosts results which
closer match the phrase query "Steve Jobs".  As an example, the concept
with concept_name="Steve Jobs" has a score of ~3.96 in the results of this
query.

However, when I execute the query after the user has selected a facet field
(The facet fields are bought up from a seperate query) and execute the
following query:

q=steve jobs&
fq=storeid:527bd613e4b0564cc755460a&
fq=tag:Person&
sort=score desc&
start=0&
rows=50&
fl=*,score&
qt=/query&
defType=edismax&
pf=concept_name^15 note_text^5 file_text^2.5&
pf3=1&
pf2=1&
ps=1&
group=true&
group.field=conceptid&
group.limit=10&
group.ngroups=true

The phrase boosting does not work, even though the facet filtering does.
The concept with concept_name="Steve Jobs" has a score of ~0.2 in the
results of this query.

I'm not sure if this is a bug, but if it is not can someone point me to the
relevant documentation that will help me fix this issue? All queries were
written using the SolrJ Library.  I also tried searching the string "Steve
Jobs" and it returned the correct results (The with concept_name "Steve
Jobs" was returned highest)

Re: Cannot use Phrase Queries in eDisMax and filtering

Posted by Tim Hearn <ti...@gmail.com>.
It is of type string.

On Mon, Nov 3, 2014 at 2:29 PM, Ramzi Alqrainy <ra...@gmail.com>
wrote:

> I tried to produce your case in my machine with below queries, but
> everything
> worked fine with me. I just want to ask you a question what is the field
> type of "tag" field ?
>
> q=bmw&
> fl=score,*&
> wt=json&
> fq=city_id:59&
> qt=/query&
> defType=edismax&
> pf=title^15%20discription^5&
> pf3=1&
> pf2=1&
> ps=1&
> qroup=true&
> group.field=member_id&
> group.limit=10&
> sort=score desc&
> group.ngroups=true
>
>
>
>
> q=bmw&
> fl=score,*&
> wt=json&
> fq=city_id:59&
> qt=/query&
> defType=edismax&
> pf=title^15%20discription^5&
> pf3=1&
> pf2=1&
> ps=1&
> qroup=true&
> group.field=member_id&
> group.limit=10&
> group.ngroups=true&
> sort=score desc&
> fq=category_id:1777
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Cannot-use-Phrase-Queries-in-eDisMax-and-filtering-tp4167302p4167338.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Cannot use Phrase Queries in eDisMax and filtering

Posted by Antoine LE FLOC'H <le...@gmail.com>.
Thanks Erick,

looking at   parseFieldBoostsAndSlop()  do you confirm that
pf3=1&
pf2=1&
is not valid and it has to be a multivalued list of fields ?

Thank you.


On Tue, Apr 19, 2016 at 1:59 AM, Erick Erickson <er...@gmail.com>
wrote:

> bq: I cannot find either the condition on the field analyzer to be able to
> use
> pf, pf2 and pf3.
>
> These don't apply to field analysis at all. What they translate into
> is a series of
> phrase queries against different sets of fields. So, you may have
> pf=fieldA^5 fieldB
> pf2=fieldA^3 fieldC
>
> Now a query like (without quotes) "big dog" would be
> translated into something like
> ...
> fieldA:"big dog"^5 fieldB:"big dog" fieldA:"big dog"^3 fieldC:"big dog"
>
> Having multiple pf fields allows you to query with different slop values,
> different boosts etc. on the same or different fields.
>
> Best,
> Erick
>
>
> On Mon, Apr 18, 2016 at 12:25 PM, Antoine LE FLOC'H <le...@gmail.com>
> wrote:
> > Hello,
> >
> > I don't have Solr source code handy but is
> > pf3=1&
> > pf2=1&
> > valid ? What would that do ? use the df or qf fields ?
> >
> > This
> >
> https://cwiki.apache.org/confluence/display/solr/The+Extended+DisMax+Query+Parser
> > says that the value of pf2 is a multivalued list of fields ? There are
> not
> > many example about this in this link.
> >
> > I cannot find either the condition on the field analyzer to be able to
> use
> > pf, pf2 and pf3.
> >
> > Feedback would be appreciated, thanks.
> >
> > Antoine.
> >
> >
> >
> >
> >
> > On Mon, Nov 3, 2014 at 8:29 PM, Ramzi Alqrainy <ramzi.alqrainy@gmail.com
> >
> > wrote:
> >
> >> I tried to produce your case in my machine with below queries, but
> >> everything
> >> worked fine with me. I just want to ask you a question what is the field
> >> type of "tag" field ?
> >>
> >> q=bmw&
> >> fl=score,*&
> >> wt=json&
> >> fq=city_id:59&
> >> qt=/query&
> >> defType=edismax&
> >> pf=title^15%20discription^5&
> >> pf3=1&
> >> pf2=1&
> >> ps=1&
> >> qroup=true&
> >> group.field=member_id&
> >> group.limit=10&
> >> sort=score desc&
> >> group.ngroups=true
> >>
> >>
> >>
> >>
> >> q=bmw&
> >> fl=score,*&
> >> wt=json&
> >> fq=city_id:59&
> >> qt=/query&
> >> defType=edismax&
> >> pf=title^15%20discription^5&
> >> pf3=1&
> >> pf2=1&
> >> ps=1&
> >> qroup=true&
> >> group.field=member_id&
> >> group.limit=10&
> >> group.ngroups=true&
> >> sort=score desc&
> >> fq=category_id:1777
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://lucene.472066.n3.nabble.com/Cannot-use-Phrase-Queries-in-eDisMax-and-filtering-tp4167302p4167338.html
> >> Sent from the Solr - User mailing list archive at Nabble.com.
> >>
>

Re: Cannot use Phrase Queries in eDisMax and filtering

Posted by Doug Turnbull <dt...@opensourceconnections.com>.
Also you mentioned your field was a string? This means the field must match
*exactly* to be considered.a phrase match. Have you considered changing the
field to text field type with a tokenizer and doing phrase matching -- it
might work more like you'd expect.

Thanks
-Doug

On Mon, Apr 18, 2016 at 7:59 PM Erick Erickson <er...@gmail.com>
wrote:

> bq: I cannot find either the condition on the field analyzer to be able to
> use
> pf, pf2 and pf3.
>
> These don't apply to field analysis at all. What they translate into
> is a series of
> phrase queries against different sets of fields. So, you may have
> pf=fieldA^5 fieldB
> pf2=fieldA^3 fieldC
>
> Now a query like (without quotes) "big dog" would be
> translated into something like
> ...
> fieldA:"big dog"^5 fieldB:"big dog" fieldA:"big dog"^3 fieldC:"big dog"
>
> Having multiple pf fields allows you to query with different slop values,
> different boosts etc. on the same or different fields.
>
> Best,
> Erick
>
>
> On Mon, Apr 18, 2016 at 12:25 PM, Antoine LE FLOC'H <le...@gmail.com>
> wrote:
> > Hello,
> >
> > I don't have Solr source code handy but is
> > pf3=1&
> > pf2=1&
> > valid ? What would that do ? use the df or qf fields ?
> >
> > This
> >
> https://cwiki.apache.org/confluence/display/solr/The+Extended+DisMax+Query+Parser
> > says that the value of pf2 is a multivalued list of fields ? There are
> not
> > many example about this in this link.
> >
> > I cannot find either the condition on the field analyzer to be able to
> use
> > pf, pf2 and pf3.
> >
> > Feedback would be appreciated, thanks.
> >
> > Antoine.
> >
> >
> >
> >
> >
> > On Mon, Nov 3, 2014 at 8:29 PM, Ramzi Alqrainy <ramzi.alqrainy@gmail.com
> >
> > wrote:
> >
> >> I tried to produce your case in my machine with below queries, but
> >> everything
> >> worked fine with me. I just want to ask you a question what is the field
> >> type of "tag" field ?
> >>
> >> q=bmw&
> >> fl=score,*&
> >> wt=json&
> >> fq=city_id:59&
> >> qt=/query&
> >> defType=edismax&
> >> pf=title^15%20discription^5&
> >> pf3=1&
> >> pf2=1&
> >> ps=1&
> >> qroup=true&
> >> group.field=member_id&
> >> group.limit=10&
> >> sort=score desc&
> >> group.ngroups=true
> >>
> >>
> >>
> >>
> >> q=bmw&
> >> fl=score,*&
> >> wt=json&
> >> fq=city_id:59&
> >> qt=/query&
> >> defType=edismax&
> >> pf=title^15%20discription^5&
> >> pf3=1&
> >> pf2=1&
> >> ps=1&
> >> qroup=true&
> >> group.field=member_id&
> >> group.limit=10&
> >> group.ngroups=true&
> >> sort=score desc&
> >> fq=category_id:1777
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://lucene.472066.n3.nabble.com/Cannot-use-Phrase-Queries-in-eDisMax-and-filtering-tp4167302p4167338.html
> >> Sent from the Solr - User mailing list archive at Nabble.com.
> >>
>

Re: Cannot use Phrase Queries in eDisMax and filtering

Posted by Erick Erickson <er...@gmail.com>.
bq: I cannot find either the condition on the field analyzer to be able to use
pf, pf2 and pf3.

These don't apply to field analysis at all. What they translate into
is a series of
phrase queries against different sets of fields. So, you may have
pf=fieldA^5 fieldB
pf2=fieldA^3 fieldC

Now a query like (without quotes) "big dog" would be
translated into something like
...
fieldA:"big dog"^5 fieldB:"big dog" fieldA:"big dog"^3 fieldC:"big dog"

Having multiple pf fields allows you to query with different slop values,
different boosts etc. on the same or different fields.

Best,
Erick


On Mon, Apr 18, 2016 at 12:25 PM, Antoine LE FLOC'H <le...@gmail.com> wrote:
> Hello,
>
> I don't have Solr source code handy but is
> pf3=1&
> pf2=1&
> valid ? What would that do ? use the df or qf fields ?
>
> This
> https://cwiki.apache.org/confluence/display/solr/The+Extended+DisMax+Query+Parser
> says that the value of pf2 is a multivalued list of fields ? There are not
> many example about this in this link.
>
> I cannot find either the condition on the field analyzer to be able to use
> pf, pf2 and pf3.
>
> Feedback would be appreciated, thanks.
>
> Antoine.
>
>
>
>
>
> On Mon, Nov 3, 2014 at 8:29 PM, Ramzi Alqrainy <ra...@gmail.com>
> wrote:
>
>> I tried to produce your case in my machine with below queries, but
>> everything
>> worked fine with me. I just want to ask you a question what is the field
>> type of "tag" field ?
>>
>> q=bmw&
>> fl=score,*&
>> wt=json&
>> fq=city_id:59&
>> qt=/query&
>> defType=edismax&
>> pf=title^15%20discription^5&
>> pf3=1&
>> pf2=1&
>> ps=1&
>> qroup=true&
>> group.field=member_id&
>> group.limit=10&
>> sort=score desc&
>> group.ngroups=true
>>
>>
>>
>>
>> q=bmw&
>> fl=score,*&
>> wt=json&
>> fq=city_id:59&
>> qt=/query&
>> defType=edismax&
>> pf=title^15%20discription^5&
>> pf3=1&
>> pf2=1&
>> ps=1&
>> qroup=true&
>> group.field=member_id&
>> group.limit=10&
>> group.ngroups=true&
>> sort=score desc&
>> fq=category_id:1777
>>
>>
>>
>> --
>> View this message in context:
>> http://lucene.472066.n3.nabble.com/Cannot-use-Phrase-Queries-in-eDisMax-and-filtering-tp4167302p4167338.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>

Re: Cannot use Phrase Queries in eDisMax and filtering

Posted by Antoine LE FLOC'H <le...@gmail.com>.
Hello,

I don't have Solr source code handy but is
pf3=1&
pf2=1&
valid ? What would that do ? use the df or qf fields ?

This
https://cwiki.apache.org/confluence/display/solr/The+Extended+DisMax+Query+Parser
says that the value of pf2 is a multivalued list of fields ? There are not
many example about this in this link.

I cannot find either the condition on the field analyzer to be able to use
pf, pf2 and pf3.

Feedback would be appreciated, thanks.

Antoine.





On Mon, Nov 3, 2014 at 8:29 PM, Ramzi Alqrainy <ra...@gmail.com>
wrote:

> I tried to produce your case in my machine with below queries, but
> everything
> worked fine with me. I just want to ask you a question what is the field
> type of "tag" field ?
>
> q=bmw&
> fl=score,*&
> wt=json&
> fq=city_id:59&
> qt=/query&
> defType=edismax&
> pf=title^15%20discription^5&
> pf3=1&
> pf2=1&
> ps=1&
> qroup=true&
> group.field=member_id&
> group.limit=10&
> sort=score desc&
> group.ngroups=true
>
>
>
>
> q=bmw&
> fl=score,*&
> wt=json&
> fq=city_id:59&
> qt=/query&
> defType=edismax&
> pf=title^15%20discription^5&
> pf3=1&
> pf2=1&
> ps=1&
> qroup=true&
> group.field=member_id&
> group.limit=10&
> group.ngroups=true&
> sort=score desc&
> fq=category_id:1777
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Cannot-use-Phrase-Queries-in-eDisMax-and-filtering-tp4167302p4167338.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Cannot use Phrase Queries in eDisMax and filtering

Posted by Ramzi Alqrainy <ra...@gmail.com>.
I tried to produce your case in my machine with below queries, but everything
worked fine with me. I just want to ask you a question what is the field
type of "tag" field ?

q=bmw&
fl=score,*&
wt=json&
fq=city_id:59&
qt=/query&
defType=edismax&
pf=title^15%20discription^5&
pf3=1&
pf2=1&
ps=1&
qroup=true&
group.field=member_id&
group.limit=10&
sort=score desc&
group.ngroups=true




q=bmw&
fl=score,*&
wt=json&
fq=city_id:59&
qt=/query&
defType=edismax&
pf=title^15%20discription^5&
pf3=1&
pf2=1&
ps=1&
qroup=true&
group.field=member_id&
group.limit=10&
group.ngroups=true&
sort=score desc& 
fq=category_id:1777



--
View this message in context: http://lucene.472066.n3.nabble.com/Cannot-use-Phrase-Queries-in-eDisMax-and-filtering-tp4167302p4167338.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Cannot use Phrase Queries in eDisMax and filtering

Posted by Tim Hearn <ti...@gmail.com>.
That was a typo in the email I did not actually send the query with a start
param of 50.  I sent it with a start param of 0, I just verified.  Sorry
for the mistake.

On Mon, Nov 3, 2014 at 1:41 PM, Ramzi Alqrainy <ra...@gmail.com>
wrote:

> The results are different, because you need to set "start" parameter 0
> instead of 50 in the first query (after filtration ) with same rows value
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Cannot-use-Phrase-Queries-in-eDisMax-and-filtering-tp4167302p4167329.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Cannot use Phrase Queries in eDisMax and filtering

Posted by Ramzi Alqrainy <ra...@gmail.com>.
The results are different, because you need to set "start" parameter 0
instead of 50 in the first query (after filtration ) with same rows value 



--
View this message in context: http://lucene.472066.n3.nabble.com/Cannot-use-Phrase-Queries-in-eDisMax-and-filtering-tp4167302p4167329.html
Sent from the Solr - User mailing list archive at Nabble.com.