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 "Mukhopadhyay, Aratrika" <Ar...@mail.house.gov> on 2018/03/20 20:25:38 UTC
Boosting Fields Based On The Query Provided
All ,
I have a solr query which I am having a hard time configuring as I would want it configured. Suppose I have a situation where I have two fields field1(host field) and field2 (url field). I want a specific host to be bubbled to the top for all terms except for when I am searching for specific people in which case I want the URL to their landing page returned first. I have configured the dismax query parser in my solrconfig but it seems that the boost being applied is arbitrary .
To be more specific if I search for terms related to star wars I want to boost the starwars.com domain but if I search for Carrie Fisher or Mark Hamill I want to boost the url http://www.imdb.com/name/nm0000402/ (Carrie Fisher's imdb page) to the top for Carrie fisher and the url http://www.imdb.com/name/nm0000434/ (Mark Hamill's imdb page) to the top for Mark Hamill . Here would be my current configuration which is not working .
<requestHandler name="/select" class="solr.SearchHandler">
<lst name="defaults">
<str name="defType">edismax</str>
<str name="q">*:*</str>
<str name="bq">host:(www.starwars.com)^10</str<http://www.starwars.com)%5e10%3c/str>>
<str name="q">Carrie Fisher</str>
<str name="bq">url:( http\:\/\/www.imdb.com\/name\/nm0000402/<http://www.imdb.com/name/nm0000402/>)^8</str>
<str name="q">Mark Hamill</str>
<str name="bq">url:( http\:\/\/www.imdb.com\/name\/nm0000434/<http://www.imdb.com/name/nm0000434/>)^8</str>
</lst>
</requestHandler>
Do any of you know how to best handle a case like this ?
Regards,
Aratrika Mukhopadhyay
RE: Boosting Fields Based On The Query Provided
Posted by "Mukhopadhyay, Aratrika" <Ar...@mail.house.gov>.
Thanks for your reply Shawn. The query elevation worked for us. I have another question though. Right now I have ways to handle specific queries in the elevate.xml. The concern I am having is that I may have hundreds of queries that need to return different pages first. Is the only way to do this via the elevate.xml or is there a better approach for instance boosting fields ? When I am boosting fields in this fashion it is not working for me :
<requestHandler name="/select" class="solr.SearchHandler">
<lst name="defaults">
<str name="defType">edismax</str>
<str name="qf"> url^50 host^30 content^20 title^10</str>
</lst>
<arr name="last-components">
<str>elevator</str>
</arr>
</requestHandler>
Thanks for your help .
Aratrika Mukhopadhyay
-----Original Message-----
From: Shawn Heisey [mailto:apache@elyograg.org]
Sent: Tuesday, March 20, 2018 6:03 PM
To: solr-user@lucene.apache.org
Subject: Re: Boosting Fields Based On The Query Provided
On 3/20/2018 2:25 PM, Mukhopadhyay, Aratrika wrote:
> I have a solr query which I am having a hard time configuring as I would want it configured. Suppose I have a situation where I have two fields field1(host field) and field2 (url field). I want a specific host to be bubbled to the top for all terms except for when I am searching for specific people in which case I want the URL to their landing page returned first. I have configured the dismax query parser in my solrconfig but it seems that the boost being applied is arbitrary .
<snip>
> <requestHandler name="/select" class="solr.SearchHandler">
> <lst name="defaults">
> <str name="defType">edismax</str>
> <str name="q">*:*</str>
> <str name="bq">host:(www.starwars.com)^10</str<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.starwars.com-29-255e10-253c_str&d=DwID-g&c=L93KkjKsAC98uTvC4KvQDTmmq1mJ2vMPtzuTpFgX8gY&r=fbfOUDlf9NEzjz9RxL3c7eXnjEvWEy5WPCDMJD237NoEoCTMyiD1VH-RfTq9OP14&m=1RjiyUG9se2vpXYg-oLAiacdECUE6khXtuvegnw_nb0&s=QkEnIzj19X_nqC298QkAUDbjv_zmP1Xr9Vn_z6BQXoM&e= >>
> <str name="q">Carrie Fisher</str>
> <str name="bq">url:( http\:\/\/www.imdb.com\/name\/nm0000402/<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.imdb.com_name_nm0000402_&d=DwID-g&c=L93KkjKsAC98uTvC4KvQDTmmq1mJ2vMPtzuTpFgX8gY&r=fbfOUDlf9NEzjz9RxL3c7eXnjEvWEy5WPCDMJD237NoEoCTMyiD1VH-RfTq9OP14&m=1RjiyUG9se2vpXYg-oLAiacdECUE6khXtuvegnw_nb0&s=ka0--rJJLml1zFZu_P1xPisIiLpXR5LwsIMm82TuoUk&e= >)^8</str>
> <str name="q">Mark Hamill</str>
> <str name="bq">url:( http\:\/\/www.imdb.com\/name\/nm0000434/<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.imdb.com_name_nm0000434_&d=DwID-g&c=L93KkjKsAC98uTvC4KvQDTmmq1mJ2vMPtzuTpFgX8gY&r=fbfOUDlf9NEzjz9RxL3c7eXnjEvWEy5WPCDMJD237NoEoCTMyiD1VH-RfTq9OP14&m=1RjiyUG9se2vpXYg-oLAiacdECUE6khXtuvegnw_nb0&s=sVRAvHN3kkJVjN8XTAWjZS85tUmOXp9W4exWvMPpGUk&e= >)^8</str>
> </lst>
> </requestHandler>
I think there's a fundamental misunderstanding of how "defaults" works.
I have no idea what happens with multiple "q" parameters, which you have configured in defaults. I do know that if your request includes a "q"
parameter, then what you've put in defaults for "q" is going to be overridden and ignored.
This section of the documentation covers defaults, appends, and invariants:
https://urldefense.proofpoint.com/v2/url?u=https-3A__lucene.apache.org_solr_guide_6-5F6_requesthandlers-2Dand-2Dsearchcomponents-2Din-2Dsolrconfig.html-23RequestHandlersandSearchComponentsinSolrConfig-2DSearchHandlers&d=DwID-g&c=L93KkjKsAC98uTvC4KvQDTmmq1mJ2vMPtzuTpFgX8gY&r=fbfOUDlf9NEzjz9RxL3c7eXnjEvWEy5WPCDMJD237NoEoCTMyiD1VH-RfTq9OP14&m=1RjiyUG9se2vpXYg-oLAiacdECUE6khXtuvegnw_nb0&s=LcNEhj3Y-S5KMW2HP0CG9t9UpRgEVsTcP7u8QgqW3tk&e=
I think the Query Elevation Component might be the kind of functionality you're after. What you're trying to do with defaults is NOT going to work.
https://urldefense.proofpoint.com/v2/url?u=https-3A__lucene.apache.org_solr_guide_6-5F6_the-2Dquery-2Delevation-2Dcomponent.html&d=DwID-g&c=L93KkjKsAC98uTvC4KvQDTmmq1mJ2vMPtzuTpFgX8gY&r=fbfOUDlf9NEzjz9RxL3c7eXnjEvWEy5WPCDMJD237NoEoCTMyiD1VH-RfTq9OP14&m=1RjiyUG9se2vpXYg-oLAiacdECUE6khXtuvegnw_nb0&s=I6TENNcAZab0ZE_j0tZ8hm8_7nuNFqhBwoey4Mm1T0E&e=
Thanks,
Shawn
Re: Boosting Fields Based On The Query Provided
Posted by Shawn Heisey <ap...@elyograg.org>.
On 3/20/2018 2:25 PM, Mukhopadhyay, Aratrika wrote:
> I have a solr query which I am having a hard time configuring as I would want it configured. Suppose I have a situation where I have two fields field1(host field) and field2 (url field). I want a specific host to be bubbled to the top for all terms except for when I am searching for specific people in which case I want the URL to their landing page returned first. I have configured the dismax query parser in my solrconfig but it seems that the boost being applied is arbitrary .
<snip>
> <requestHandler name="/select" class="solr.SearchHandler">
> <lst name="defaults">
> <str name="defType">edismax</str>
> <str name="q">*:*</str>
> <str name="bq">host:(www.starwars.com)^10</str<http://www.starwars.com)%5e10%3c/str>>
> <str name="q">Carrie Fisher</str>
> <str name="bq">url:( http\:\/\/www.imdb.com\/name\/nm0000402/<http://www.imdb.com/name/nm0000402/>)^8</str>
> <str name="q">Mark Hamill</str>
> <str name="bq">url:( http\:\/\/www.imdb.com\/name\/nm0000434/<http://www.imdb.com/name/nm0000434/>)^8</str>
> </lst>
> </requestHandler>
I think there's a fundamental misunderstanding of how "defaults" works.
I have no idea what happens with multiple "q" parameters, which you have
configured in defaults. I do know that if your request includes a "q"
parameter, then what you've put in defaults for "q" is going to be
overridden and ignored.
This section of the documentation covers defaults, appends, and invariants:
https://lucene.apache.org/solr/guide/6_6/requesthandlers-and-searchcomponents-in-solrconfig.html#RequestHandlersandSearchComponentsinSolrConfig-SearchHandlers
I think the Query Elevation Component might be the kind of functionality
you're after. What you're trying to do with defaults is NOT going to work.
https://lucene.apache.org/solr/guide/6_6/the-query-elevation-component.html
Thanks,
Shawn