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 Vincent Pérès <vi...@gmail.com> on 2009/05/19 18:37:01 UTC
How to change the weight of the fields ?
Hello,
I'm stuck my the boost feature...
I'm doing the following query :
http://localhost:8983/solr/select/?q=novel&bf=title_s^5.0&fl=title_s+isbn_s&version=2.2&start=0&rows=5&indent=on&debugQuery=on
Below a part of my debug (the results are correct) :
<lst name="debug">
<str name="rawquerystring">novel</str>
<str name="querystring">novel</str>
<str name="parsedquery">text:novel</str>
<str name="parsedquery_toString">text:novel</str>
−
<lst name="explain">
−
<str name="Listing:397">
0.6041825 = (MATCH) fieldWeight(text:novel in 395), product of:
1.7320508 = tf(termFreq(text:novel)=3)
3.1892564 = idf(docFreq=55, numDocs=500)
0.109375 = fieldNorm(field=text, doc=395)
</str>
−
<str name="Listing:445">
0.51787066 = (MATCH) fieldWeight(text:novel in 443), product of:
1.7320508 = tf(termFreq(text:novel)=3)
3.1892564 = idf(docFreq=55, numDocs=500)
0.09375 = fieldNorm(field=text, doc=443)
</str>
It seems Solr is only evaluating the 'text' field and skip the 'title_s'
field.
The line in the schema for dynamic string is :
<dynamicField name="*_s" type="string" indexed="true" stored="true"
omitNorms="false" />
Do I need to enable something else to be able to change the weight of my
fields?
Thanks very much
Vincent
--
View this message in context: http://www.nabble.com/How-to-change-the-weight-of-the-fields---tp23619971p23619971.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: How to change the weight of the fields ?
Posted by Otis Gospodnetic <ot...@yahoo.com>.
Hi,
I'm not sure why the rest of the scoring explanation is not shown, but your query *was* expanded to search on text and title_s, and id fields, so I think that expanded/rewritten query is what went to the index.
Otis
--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch
----- Original Message ----
> From: Vincent Pérès <vi...@gmail.com>
> To: solr-user@lucene.apache.org
> Sent: Thursday, May 21, 2009 4:34:00 AM
> Subject: Re: How to change the weight of the fields ?
>
>
> It seems I can only search on the field 'text'. With the following url :
> http://localhost:8983/solr/select/?q=novel&qt=dismax&fl=title_s,id&version=2.2&start=0&rows=10&indent=on&debugQuery=on
>
> I get answers, but on the debug area, it seems it's only searching on the
> 'text' field (with or without 'qt' the results are displayed within the same
> order) :
>
>
> novel
> novel
> −
>
> +DisjunctionMaxQuery((text:novel^0.5 | title_s:novel^5.0 |
> id:novel^10.0)~0.01) ()
>
> −
>
> +(text:novel^0.5 | title_s:novel^5.0 | id:novel^10.0)~0.01 ()
>
> −
>
> −
>
>
> 0.014641666 = (MATCH) sum of:
> 0.014641666 = (MATCH) max plus 0.01 times others of:
> 0.014641666 = (MATCH) weight(text:novel^0.5 in 114927), product of:
> 0.01362607 = queryWeight(text:novel^0.5), product of:
> 0.5 = boost
> 3.4734163 = idf(docFreq=10634, numDocs=43213)
> 0.007845918 = queryNorm
> 1.0745333 = (MATCH) fieldWeight(text:novel in 114927), product of:
> 1.4142135 = tf(termFreq(text:novel)=2)
> 3.4734163 = idf(docFreq=10634, numDocs=43213)
> 0.21875 = fieldNorm(field=text, doc=114927)
>
> etc.....
>
> I should have a debug below with a search of the term into 'title_s' and
> 'id' no?
>
> Thanks for your answers !
> Vincent
> --
> View this message in context:
> http://www.nabble.com/How-to-change-the-weight-of-the-fields---tp23619971p23649624.html
> Sent from the Solr - User mailing list archive at Nabble.com.
Re: How to change the weight of the fields ?
Posted by Vincent Pérès <vi...@gmail.com>.
It seems I can only search on the field 'text'. With the following url :
http://localhost:8983/solr/select/?q=novel&qt=dismax&fl=title_s,id&version=2.2&start=0&rows=10&indent=on&debugQuery=on
I get answers, but on the debug area, it seems it's only searching on the
'text' field (with or without 'qt' the results are displayed within the same
order) :
<lst name="debug">
<str name="rawquerystring">novel</str>
<str name="querystring">novel</str>
−
<str name="parsedquery">
+DisjunctionMaxQuery((text:novel^0.5 | title_s:novel^5.0 |
id:novel^10.0)~0.01) ()
</str>
−
<str name="parsedquery_toString">
+(text:novel^0.5 | title_s:novel^5.0 | id:novel^10.0)~0.01 ()
</str>
−
<lst name="explain">
−
<str name="33395">
0.014641666 = (MATCH) sum of:
0.014641666 = (MATCH) max plus 0.01 times others of:
0.014641666 = (MATCH) weight(text:novel^0.5 in 114927), product of:
0.01362607 = queryWeight(text:novel^0.5), product of:
0.5 = boost
3.4734163 = idf(docFreq=10634, numDocs=43213)
0.007845918 = queryNorm
1.0745333 = (MATCH) fieldWeight(text:novel in 114927), product of:
1.4142135 = tf(termFreq(text:novel)=2)
3.4734163 = idf(docFreq=10634, numDocs=43213)
0.21875 = fieldNorm(field=text, doc=114927)
</str>
etc.....
I should have a debug below with a search of the term into 'title_s' and
'id' no?
Thanks for your answers !
Vincent
--
View this message in context: http://www.nabble.com/How-to-change-the-weight-of-the-fields---tp23619971p23649624.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: How to change the weight of the fields ?
Posted by Vincent Pérès <vi...@gmail.com>.
I tried the following request after changed the dismax :
http://localhost:8983/solr/listings/select/?q=novel&qt=dismax&qf=title_s^2.0&fl=title_s+isbn_s&version=2.2&start=0&rows=5&indent=on&debugQuery=on
But I don't get any results :
<lst name="debug">
<str name="rawquerystring">novel</str>
<str name="querystring">novel</str>
<str name="parsedquery">+DisjunctionMaxQuery((title_s:novel^2.0)~0.01)
()</str>
<str name="parsedquery_toString">+(title_s:novel^2.0)~0.01 ()</str>
<lst name="explain"/>
<str name="QParser">DismaxQParser</str>
<null name="altquerystring"/>
−
<arr name="boostfuncs">
<str>
</str>
</arr>
−
<lst name="timing">
<double name="time">3.0</double>
−
<lst name="prepare">
<double name="time">1.0</double>
−
<lst name="org.apache.solr.handler.component.QueryComponent">
<double name="time">1.0</double>
</lst>
etc....
Do I need to add some specific attributes to my string fields?
It looks now like this :
<dynamicField name="*_s" type="string" indexed="true" stored="true"
omitNorms="false"/>
and below :
<copyField source="*_s" dest="text"/>
Thanks !!
Vincent
--
View this message in context: http://www.nabble.com/How-to-change-the-weight-of-the-fields---tp23619971p23631247.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: How to change the weight of the fields ?
Posted by Vincent Pérès <vi...@gmail.com>.
Hello,
I'm sorry I wrote a mistake, I mean :
http://localhost:8983/solr/listings/select/?q=novel&qf=title_s^5.0&fl=title_s+isbn_s&version=2.2&start=0&rows=5&indent=on&debugQuery=on
(using qf (Query Fields))
But it seems I need to add dismax as well and configure it by default in
solr config?
Thanks for your answer !
Vincent
--
View this message in context: http://www.nabble.com/How-to-change-the-weight-of-the-fields---tp23619971p23631022.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: How to change the weight of the fields ?
Posted by Koji Sekiguchi <ko...@r.email.ne.jp>.
Vincent,
You need to add defType=dismax when using bf parameter.
Please see:
http://wiki.apache.org/solr/DisMaxRequestHandler
Koji
Vincent Pérès wrote:
> Hello,
>
> I'm stuck my the boost feature...
>
> I'm doing the following query :
>
> http://localhost:8983/solr/select/?q=novel&bf=title_s^5.0&fl=title_s+isbn_s&version=2.2&start=0&rows=5&indent=on&debugQuery=on
>
> Below a part of my debug (the results are correct) :
>
> <lst name="debug">
> <str name="rawquerystring">novel</str>
> <str name="querystring">novel</str>
> <str name="parsedquery">text:novel</str>
> <str name="parsedquery_toString">text:novel</str>
> −
> <lst name="explain">
> −
> <str name="Listing:397">
>
> 0.6041825 = (MATCH) fieldWeight(text:novel in 395), product of:
> 1.7320508 = tf(termFreq(text:novel)=3)
> 3.1892564 = idf(docFreq=55, numDocs=500)
> 0.109375 = fieldNorm(field=text, doc=395)
> </str>
> −
> <str name="Listing:445">
>
> 0.51787066 = (MATCH) fieldWeight(text:novel in 443), product of:
> 1.7320508 = tf(termFreq(text:novel)=3)
> 3.1892564 = idf(docFreq=55, numDocs=500)
> 0.09375 = fieldNorm(field=text, doc=443)
> </str>
>
>
> It seems Solr is only evaluating the 'text' field and skip the 'title_s'
> field.
> The line in the schema for dynamic string is :
> <dynamicField name="*_s" type="string" indexed="true" stored="true"
> omitNorms="false" />
>
> Do I need to enable something else to be able to change the weight of my
> fields?
>
> Thanks very much
> Vincent
>