Add fl=*,score to your URL, so that you get the “score” field back in the 
response.  That’s the field value that generates the order of the results when 
sorting by relevancy.  That value should go up for each boost.

My initial guess is that the score is being pushed up so much by the 
“inhabitants” boost that any score increase generated by placing the 
“importance” boost on top of it is like spitting in the ocean.  The score will 
go up on the documents, but not enough to effect their order.

Also, why the choice of ord()?  It’s maximum value for “importance” will be 3 
(if I understand that field correctly), while for “inhabitants” the max value 
will be nearly equal to the number of documents in the index.  At least, that’s 
my understanding of ord() from http://wiki.apache.org/solr/FunctionQuery#ord.

You may need to make the function associated with “inhabitants” more complex.  
Something that will increase but eventually get capped (maybe at 10?).  Then 
use “field(importance)” as the other function, which will evaluate to values of 
1, 5, or 10.

Or there may be something else entirely going on.  But I’d start with seeing 
how the “score” field changes for each of the boosts.

On Oct 17, 2014, at 1:32 AM, Jens Mayer 
<mjen...@yahoo.com<mailto:mjen...@yahoo.com>> wrote:

@Ahmet yes I've added it. :)

@Garth

First here is my complete url 
http://localhost:8080/solr/collection1/select?q=K&wt=json&indent=true&defType=edismax&bf=ord%28inhabitants%29&bf=ord%28importance%29&qf=city^10+zip^8+suburb^2+street&mm=1&stopwords=true&lowercaseOperators=true

And here the different search results:

no bf boost:


{
  "responseHeader":{
    "status":0,
    "QTime":0,
    "params":{
      "mm":"1",
      "q":"K",
      "defType":"edismax",
      "indent":"true",
      "qf":"city^10 zip^8 suburb^2 street",
      "wt":"json",
      "lowercaseOperators":"true",
      "stopwords":"true"}},
  "response":{"numFound":218028,"start":0,"docs":[
      {
        "zip":"01561",
        "city":"Kleinnaundorf",
        "importance":1,
        "latitude":51.248491,
        "latlong":"51.2484910,13.7908023",
        "city_appendix":"",
        "street":"Am Storchennest",
        "house_no_to":"",
        "suburb":"-",
        "id":"7f000101-4908-1bdd-8149-08deddd759af",
        "house_no_from":"",
        "longitude":13.7908023,
        "_version_":1481861494822928391},
      {
        "zip":"01561",
        "city":"Kleinnaundorf",
        "importance":1,
        "latitude":51.2435855,
        "latlong":"51.2435855,13.7628945",
        "city_appendix":"",
        "street":"An der Krebsmühle",
        "house_no_to":"",
        "suburb":"-",
        "id":"7f000101-4908-1bdd-8149-08deddd759b0",
        "house_no_from":"",
        "longitude":13.7628945,
        "_version_":1481861494822928392},
      {
        "zip":"01561",
        "city":"Kleinnaundorf",
        "importance":1,
        "latitude":51.2466002,
        "latlong":"51.2466002,13.7922765",
        "city_appendix":"",
        "street":"Dorfplatz",
        "house_no_to":"",
        "suburb":"-",
        "id":"7f000101-4908-1bdd-8149-08deddd759b1",
        "house_no_from":"",
        "longitude":13.7922765,
        "_version_":1481861494823976960},
      {
        "zip":"01561",
        "city":"Kleinnaundorf",
        "importance":1,
        "latitude":51.2482685,
        "latlong":"51.2482685,13.7933677",
        "city_appendix":"",
        "street":"Dorfstr.",
        "house_no_to":"",
        "suburb":"-",
        "id":"7f000101-4908-1bdd-8149-08deddd759b2",
        "house_no_from":"",
        "longitude":13.7933677,
        "_version_":1481861494823976961},
      {
        "zip":"01561",
        "city":"Kleinnaundorf",
        "importance":1,
        "latitude":51.2474526,
        "latlong":"51.2474526,13.7822535",
        "city_appendix":"",
        "street":"Hauptstr.",
        "house_no_to":"",
        "suburb":"-",
        "id":"7f000101-4908-1bdd-8149-08deddd759b3",
        "house_no_from":"",
        "longitude":13.7822535,
        "_version_":1481861494823976962}]
  }}

 boost of just importance:

{
  "responseHeader":{
    "status":0,
    "QTime":0,
    "params":{
      "mm":"1",
      "q":"K",
      "defType":"edismax",
      "bf":"ord(importance)",
      "indent":"true",
      "qf":"city^10 zip^8 suburb^2 street",
      "wt":"json",
      "lowercaseOperators":"true",
      "stopwords":"true"}},
  "response":{"numFound":218028,"start":0,"docs":[
      {
        "zip":"",
        "city":"Kaaks",
        "importance":10,
        "latitude":53.98969861764706,
        "latlong":"53.9896986,9.4720857",
        "city_appendix":"",
        "street":"-",
        "house_no_to":"-",
        "suburb":"-",
        "id":"7f000101-4908-1bdd-8149-08ea634f239e",
        "house_no_from":"-",
        "longitude":9.472085664705885,
        "_version_":1481861614576599047},
      {
        "zip":"",
        "city":"Kaarst",
        "importance":10,
        "latitude":51.21732054972778,
        "latlong":"51.2173205,6.6094348",
        "city_appendix":"",
        "street":"-",
        "house_no_to":"-",
        "suburb":"-",
        "id":"7f000101-4908-1bdd-8149-08ea634f239f",
        "house_no_from":"-",
        "longitude":6.609434760254092,
        "_version_":1481861614576599048},
      {
        "zip":"",
        "city":"Kaarz",
        "importance":10,
        "latitude":53.697275700000006,
        "latlong":"53.6972757,11.7279977",
        "city_appendix":"",
        "street":"-",
        "house_no_to":"-",
        "suburb":"-",
        "id":"7f000101-4908-1bdd-8149-08ea634f23a0",
        "house_no_from":"-",
        "longitude":11.727997725,
        "_version_":1481861614576599049},
      {
        "zip":"",
        "city":"Kaarßen",
        "importance":10,
        "latitude":53.190326544444446,
        "latlong":"53.1903265,11.0481581",
        "city_appendix":"",
        "street":"-",
        "house_no_to":"-",
        "suburb":"-",
        "id":"7f000101-4908-1bdd-8149-08ea634f23a1",
        "house_no_from":"-",
        "longitude":11.048158100000002,
        "_version_":1481861614576599050},
      {
        "zip":"",
        "city":"Kabelhorst",
        "importance":10,
        "latitude":54.221832408333334,
        "latlong":"54.2218324,10.9249574",
        "city_appendix":"",
        "street":"-",
        "house_no_to":"-",
        "suburb":"-",
        "id":"7f000101-4908-1bdd-8149-08ea634f23a2",
        "house_no_from":"-",
        "longitude":10.924957416666667,
        "_version_":1481861614576599051}]
  }}


boost of just inhabitants

{
  "responseHeader":{
    "status":0,
    "QTime":0,
    "params":{
      "mm":"1",
      "q":"K",
      "defType":"edismax",
      "bf":"ord(inhabitants)",
      "indent":"true",
      "qf":"city^10 zip^8 suburb^2 street",
      "wt":"json",
      "lowercaseOperators":"true",
      "stopwords":"true"}},
  "response":{"numFound":218028,"start":0,"docs":[
      {
        "zip":"76131",
        "inhabitants":296033,
        "city":"Karlsruhe",
        "importance":1,
        "latitude":49.0255482,
        "latlong":"49.0255482,8.4459303",
        "city_appendix":", Baden",
        "street":"Am Fächerbad",
        "house_no_to":"",
        "suburb":"Hagsfeld",
        "id":"7f000101-4908-1bdd-8149-08e64c107535",
        "house_no_from":"",
        "longitude":8.4459303,
        "_version_":1481861578588422156},
      {
        "zip":"76131",
        "inhabitants":296033,
        "city":"Karlsruhe",
        "importance":1,
        "latitude":49.0271384,
        "latlong":"49.0271384,8.4431323",
        "city_appendix":", Baden",
        "street":"Am Sportpark",
        "house_no_to":"",
        "suburb":"Hagsfeld",
        "id":"7f000101-4908-1bdd-8149-08e64c107536",
        "house_no_from":"",
        "longitude":8.4431323,
        "_version_":1481861578588422157},
      {
        "zip":"76131",
        "inhabitants":296033,
        "city":"Karlsruhe",
        "importance":1,
        "latitude":49.0256398,
        "latlong":"49.0256398,8.4353130",
        "city_appendix":", Baden",
        "street":"Büchiger Allee",
        "house_no_to":"998",
        "suburb":"Hagsfeld",
        "id":"7f000101-4908-1bdd-8149-08e64c107537",
        "house_no_from":"18",
        "longitude":8.435313,
        "_version_":1481861578588422158},
      {
        "zip":"76131",
        "inhabitants":296033,
        "city":"Karlsruhe",
        "importance":1,
        "latitude":49.0079486,
        "latlong":"49.0079486,8.4139096",
        "city_appendix":", Baden",
        "street":"Am Künstlerhaus",
        "house_no_to":"",
        "suburb":"Innenstadt-Ost",
        "id":"7f000101-4908-1bdd-8149-08e64c107538",
        "house_no_from":"",
        "longitude":8.4139096,
        "_version_":1481861578589470720},
      {
        "zip":"76131",
        "inhabitants":296033,
        "city":"Karlsruhe",
        "importance":1,
        "latitude":49.0184689,
        "latlong":"49.0184689,8.4070077",
        "city_appendix":", Baden",
        "street":"An der Fasanengartenmauer",
        "house_no_to":"",
        "suburb":"Innenstadt-Ost",
        "id":"7f000101-4908-1bdd-8149-08e64c107539",
        "house_no_from":"",
        "longitude":8.4070077,
        "_version_":1481861578589470721}]
  }}

boost of importance and inhabitants

{
  "responseHeader":{
    "status":0,
    "QTime":58,
    "params":{
      "mm":"1",
      "q":"K",
      "defType":"edismax",
      "bf":["ord(importance)",
        "ord(inhabitants)"],
      "indent":"true",
      "qf":"city^10 zip^8 suburb^2 street",
      "wt":"json",
      "lowercaseOperators":"true",
      "stopwords":"true"}},
  "response":{"numFound":218028,"start":0,"docs":[
      {
        "zip":"76131",
        "inhabitants":296033,
        "city":"Karlsruhe",
        "importance":1,
        "latitude":49.0255482,
        "latlong":"49.0255482,8.4459303",
        "city_appendix":", Baden",
        "street":"Am Fächerbad",
        "house_no_to":"",
        "suburb":"Hagsfeld",
        "id":"7f000101-4908-1bdd-8149-08e64c107535",
        "house_no_from":"",
        "longitude":8.4459303,
        "_version_":1481861578588422156},
      {
        "zip":"76131",
        "inhabitants":296033,
        "city":"Karlsruhe",
        "importance":1,
        "latitude":49.0271384,
        "latlong":"49.0271384,8.4431323",
        "city_appendix":", Baden",
        "street":"Am Sportpark",
        "house_no_to":"",
        "suburb":"Hagsfeld",
        "id":"7f000101-4908-1bdd-8149-08e64c107536",
        "house_no_from":"",
        "longitude":8.4431323,
        "_version_":1481861578588422157},
      {
        "zip":"76131",
        "inhabitants":296033,
        "city":"Karlsruhe",
        "importance":1,
        "latitude":49.0256398,
        "latlong":"49.0256398,8.4353130",
        "city_appendix":", Baden",
        "street":"Büchiger Allee",
        "house_no_to":"998",
        "suburb":"Hagsfeld",
        "id":"7f000101-4908-1bdd-8149-08e64c107537",
        "house_no_from":"18",
        "longitude":8.435313,
        "_version_":1481861578588422158},
      {
        "zip":"76131",
        "inhabitants":296033,
        "city":"Karlsruhe",
        "importance":1,
        "latitude":49.0079486,
        "latlong":"49.0079486,8.4139096",
        "city_appendix":", Baden",
        "street":"Am Künstlerhaus",
        "house_no_to":"",
        "suburb":"Innenstadt-Ost",
        "id":"7f000101-4908-1bdd-8149-08e64c107538",
        "house_no_from":"",
        "longitude":8.4139096,
        "_version_":1481861578589470720},
      {
        "zip":"76131",
        "inhabitants":296033,
        "city":"Karlsruhe",
        "importance":1,
        "latitude":49.0184689,
        "latlong":"49.0184689,8.4070077",
        "city_appendix":", Baden",
        "street":"An der Fasanengartenmauer",
        "house_no_to":"",
        "suburb":"Innenstadt-Ost",
        "id":"7f000101-4908-1bdd-8149-08e64c107539",
        "house_no_from":"",
        "longitude":8.4070077,
        "_version_":1481861578589470721}]
  }}

I can't see any differents between only inhabitants and inhabitants and 
importance.
I expected that the first result is the city Karlsruhe with 296k inhabitans and 
the importance value of 10.


Garth Grimm 
<garthgr...@averyranchconsulting.com<mailto:garthgr...@averyranchconsulting.com>>
 schrieb am 16:40 Donnerstag, 16.Oktober 2014:


Spaces should work just fine.  Can you show us exactly what is happening with 
the score that leads you to the conclusion that it isn’t working?

Some testing from an example collection I have…

No boost:
http://localhost:8983/solr/collection1/select?q=text%3Abook&fl=id%2Cprice%2Cyearpub%2Cscore&wt=csv&defType=edismax
id,price,yearpub,score
db9780819562005,13.21,1989,0.40321594
db1562399055,17.87,2001,0.28511673
db0072519096,66.67,2008,0.28511673
db0140236392,10.88,1994,0.28511673
db04,44.99,2007,0.25200996
db07,19.77,2005,0.25200996
db0763777595,24.44,2002,0.25200996
db0879305835,43.58,2011,0.24947715
db1933550309,18.99,2004,0.24691834
db02,40.09,2009,0.21383755
Boost of just yearpub:

http://localhost:8983/solr/collection1/select?q=text%3Abook&fl=id%2Cprice%2Cyearpub%2Cscore&wt=csv&defType=edismax&bf=ord%28yearpub%29
id,price,yearpub,score
db0879305835,43.58,2011,11.069619
db1847195881,33.62,2010,10.635455
db02,40.09,2009,10.233932
db0072519096,66.67,2008,9.897689
db0316033723,23.1,2008,9.821208
db04,44.99,2007,9.465844
db05,44.99,2007,9.419684
db9780061336461,12.18,2007,9.398244
db07,19.77,2005,8.662797
db1933550309,18.99,2004,8.256611
boost of yearpub and price, using just a space as separator:
http://localhost:8983/solr/collection1/select?q=text%3Abook&fl=id%2Cprice%2Cyearpub%2Cscore&wt=csv&defType=edismax&bf=ord%28yearpub%29%20ord%28price%29
id,price,yearpub,score
db0072519096,66.67,2008,28.933228
db0879305835,43.58,2011,28.15772
db04,44.99,2007,27.414654
db05,44.99,2007,27.371819
db02,40.09,2009,27.009602
db1847195881,33.62,2010,26.636993
db9780201896831,57.43,1997,24.749598
db0767914384,37.87,1997,22.835175
db0316033723,23.1,2008,21.037462
db0763777595,24.44,2002,19.58986
Score keeps increasing with each boost.

Regards,
Garth


> Hey Ahmet,
>
> thanks for your answer.
> I've read about this on the following page:
> http://wiki.apache.org/solr/FunctionQuery
> Using FunctionQuery point 3:
> "The bf parameter actually takes a list of function queries separated by 
> whitespace and each with an optional boost."
>
> If I write it the way you suggested, the result is the same.
> Only inhabitants ranked up and importance will be ignored.
>
> greetings
>
>
>
>
> Ahmet Arslan <iori...@yahoo.com<mailto:iori...@yahoo.com>> schrieb am 20:26 
> Dienstag, 14.Oktober 2014:
>
>
>
> Hi Jens,
>
> Where did you read that you can write it separated by white spaces?
>
> bq and bf are both can be defined multiple times.
>
> q=foo&bf=ord(inhabitants)bf=ord(importance)
>
> Ahmet
>
>
>
>
> On Tuesday, October 14, 2014 6:34 PM, Jens Mayer 
> <mjen...@yahoo.com.INVALID<mailto:mjen...@yahoo.com.INVALID>> wrote:
> Hey everyone,
>
> I have a question about the boost function of solr.
> The documentation say about multiple function querys that I can write it 
> seperated by whitespaces.
>
> Example: q=foo&bf=ord(popularity)^0.5 recip(rord(price),1,1000,1000)^0.3
>
> Now I have two fields I like to boost. Inhabitants and importance.
> The field Inhabitants contain the inhabitants of citys. and the field 
> importance contain a priority value - citys have the value 10, suburb the 
> value 5 and streets the value 1.
> If I use the bf parameter I can boost inhabitants so that citys with the most 
> inhabitants ranked up.
>
> Example: q=foo&bf=ord(inhabitants)
>
> The same happens if I boost importance.
>
> Example: q=foo&bf=ord(importance)
>
> But if I try to combine both so that importance and inhabitants ranked up
> only inhabitants will be ranked up and importance will be ignored.
>
> Example: q=foo&bf=ord(inhabitants) ord(importance)
>
> Knows anyone how I can fix this problem?
>
>
> greetings



Reply via email to