Skip to content

Commit 90e65d2

Browse files
committed
Even better.
1 parent 0e07601 commit 90e65d2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

api/server.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ async def lookup(string: str,
447447
"query": query,
448448
# qf = query fields, i.e. how should we boost these fields if they contain the query terms.
449449
# https://solr.apache.org/guide/solr/latest/query-guide/dismax-query-parser.html#qf-query-fields-parameter
450-
"qf": "preferred_name_exactish^400 names_exactish^300 preferred_name^4 names^2",
450+
"qf": "preferred_name_exactish^500 names_exactish^400 preferred_name^4 names^2",
451451
# pf = phrase fields, i.e. how should we boost these fields if they contain query terms close together.
452452
# https://solr.apache.org/guide/solr/latest/query-guide/dismax-query-parser.html#pf-phrase-fields-parameter
453453
"pf": "preferred_name_exactish^20 names_exactish^10 preferred_name^4 names^2",
@@ -460,18 +460,18 @@ async def lookup(string: str,
460460
# However, this approach causes very large clique_identifier_count entries (like diphenhydramine, cic=1332)
461461
# to be returned when we don't have an otherwise good match. So instead we make it stepwise:
462462
# - If clique_identifier_count == 1, we reduce the boost by 0.7x
463-
"if(eq(clique_identifier_count, 1), 0.7, 1)",
463+
# "if(eq(clique_identifier_count, 1), 0.7, 1)",
464464
# - If clique_identifier_count > 10, we boost by a further 2x
465-
"if(gt(clique_identifier_count, 10), 2, 1)",
465+
"if(gt(clique_identifier_count, 20), 5, if(gt(clique_identifier_count, 10), 3, 1))",
466466
# - If clique_identifier_count > 20, we boost by a further 3x
467-
"if(gt(clique_identifier_count, 20), 3, 1)",
468467
# Slightly boost model organisms: humans, mice, rats, zebrafish and C. elegans
469468
'''sum(1,
470-
product(termfreq(taxa,"NCBITaxon:9606"),10),
471-
product(termfreq(taxa,"NCBITaxon:10090"),5),
472-
product(termfreq(taxa,"NCBITaxon:10116"),4),
473-
product(termfreq(taxa,"NCBITaxon:7955"),3),
474-
product(termfreq(taxa,"NCBITaxon:6239"),2)
469+
if(not(taxon_specific), 100, 0),
470+
product(termfreq(taxa,"NCBITaxon:9606"),100),
471+
product(termfreq(taxa,"NCBITaxon:10090"),40),
472+
product(termfreq(taxa,"NCBITaxon:10116"),30),
473+
product(termfreq(taxa,"NCBITaxon:7955"),20),
474+
product(termfreq(taxa,"NCBITaxon:6239"),10)
475475
)'''
476476
],
477477
},

0 commit comments

Comments
 (0)