[Koha-bugs] [Bug 23649] Elasticsearch offer an option to weight search results by type

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Feb 13 16:53:26 CET 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23649

--- Comment #5 from Björn Nylén <bjorn.nylen at ub.lu.se> ---
More interesting things can be done eg. maths:  

In this case we want to promote newer books over older. So define a new numeric
field 'pubyear-numeric' in the ES mappings and map it to 008/07-10.
After some existance- and sanity-checking we weight records (in this case)
newer than 1980 higher. 

- script_score:
    script:
      source: "long y = doc['pubyear-numeric'].size()==0 ? params.start :
doc['pubyear-numeric'].value; y = (y<params.start || y>2100) ? params.start :
y;  return (y-params.start)/params.divider+1;"
      params:
        start: 1980
        divider: 20

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list