Skip to content

Commit

Permalink
Merge pull request #89 from TranslatorSRI/try-sort-by-curie-suffix
Browse files Browse the repository at this point in the history
This PR adds support for sorting results by the CURIE suffix, which requires:
1. Loading the CURIE suffix from the JSON files generated by Babel in data-loading (in PR TranslatorSRI/Babel#179).
2. Indexing it as a long numerical field in data-loading (so we can do a numerical sort instead of an alphabetical sort).
3. Updating our search sort to sort by score first, followed by sorting by the CURIE suffix for entries that have identical scores.
  • Loading branch information
gaurav authored Aug 25, 2023
2 parents 2148386 + 69e634d commit baa6ab2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions api/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ async def lookup(string: str,
"pf": "preferred_name_exactish^20 preferred_name^3 names^2"
},
},
"sort": "score DESC, curie_suffix ASC",
"limit": limit,
"offset": offset,
"filter": filters
Expand Down
10 changes: 9 additions & 1 deletion data-loading/setup-and-load-solr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,15 @@ curl -X POST -H 'Content-type:application/json' --data-binary '{
"name":"shortest_name_length",
"type":"pint",
"stored":true
}
},
{
"name":"curie_suffix",
"type":"plong",
"docValues":true,
"stored":true,
"required":false,
"sortMissingLast":true
}
] }' 'http://localhost:8983/solr/name_lookup/schema'

# Add a copy field to copy preferred_name into preferred_name_exactish.
Expand Down

0 comments on commit baa6ab2

Please sign in to comment.