Issue 12583
Simplify Solr quieries by using request handlers
12583
Reporter: fmendez
Assignee: fmendez
Type: Task
Summary: Simplify Solr quieries by using request handlers
Priority: Major
Resolution: Fixed
Status: Closed
Created: 2013-01-10 12:28:29.491
Updated: 2017-10-06 15:35:41.52
Resolved: 2017-10-06 15:35:41.504
Description: NameUsage and registry search can be simplified by moving some constants to a Solr request handler, for example in NameUsageSearchServiceImpl the code below can be replaced by invariants in a request handler:
PRIMARY_SORT_ORDER.put("score", SolrQuery.ORDER.desc);
PRIMARY_SORT_ORDER.put("num_descendants", SolrQuery.ORDER.desc);
PRIMARY_SORT_ORDER.put("scientific_name", SolrQuery.ORDER.asc);
// Suggest default filters for suggest service: names of type INFORMAL and BLACKLISTED are excluded by default.
SUGGEST_DEFAULT_FILTERS.put(NameUsageSearchParameter.NAME_TYPE, NOT_OP + NameType.INFORMAL.name());
SUGGEST_DEFAULT_FILTERS.put(NameUsageSearchParameter.NAME_TYPE, NOT_OP + NameType.BLACKLISTED.name());
The shards parameter could be moved to a request handler, and possibly all the weights associated to fields can be moved to a request handler too, for example:
@FullTextSearchField(field = "canonical_name", exactMatchScore = 100.0d,
partialMatchScore = 1d, partialMatching = WildcardPadding.RIGHT),
@FullTextSearchField(field = "vernacular_name", highlightField = "vernacular_name_lang", exactMatchScore = 10d,
partialMatchScore = 0.75d, partialMatching = WildcardPadding.RIGHT),
@FullTextSearchField(field = "scientific_name", exactMatchScore = 5d,
partialMatchScore = 0.7d, partialMatching = WildcardPadding.RIGHT),
@FullTextSearchField(field = "description", exactMatchScore = 0.2d,
partialMatching = WildcardPadding.NONE)
]]>