mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
dspace-api: set search fields in Solr query only if we are interested in the actual search results
This commit is contained in:
@@ -861,16 +861,20 @@ public class SolrServiceImpl implements SearchService, IndexingService {
|
||||
|
||||
solrQuery.setQuery(query);
|
||||
|
||||
// Add any search fields to our query. This is the limited list
|
||||
// of fields that will be returned in the solr result
|
||||
for (String fieldName : discoveryQuery.getSearchFields()) {
|
||||
solrQuery.addField(fieldName);
|
||||
if (discoveryQuery.getMaxResults() != 0) {
|
||||
// set search fields in Solr query only if we are interested in the actual search results
|
||||
|
||||
// Add any search fields to our query. This is the limited list
|
||||
// of fields that will be returned in the solr result
|
||||
for (String fieldName : discoveryQuery.getSearchFields()) {
|
||||
solrQuery.addField(fieldName);
|
||||
}
|
||||
// Also ensure a few key obj identifier fields are returned with every query
|
||||
solrQuery.addField(SearchUtils.RESOURCE_TYPE_FIELD);
|
||||
solrQuery.addField(SearchUtils.RESOURCE_ID_FIELD);
|
||||
solrQuery.addField(SearchUtils.RESOURCE_UNIQUE_ID);
|
||||
solrQuery.addField(STATUS_FIELD);
|
||||
}
|
||||
// Also ensure a few key obj identifier fields are returned with every query
|
||||
solrQuery.addField(SearchUtils.RESOURCE_TYPE_FIELD);
|
||||
solrQuery.addField(SearchUtils.RESOURCE_ID_FIELD);
|
||||
solrQuery.addField(SearchUtils.RESOURCE_UNIQUE_ID);
|
||||
solrQuery.addField(STATUS_FIELD);
|
||||
|
||||
if (discoveryQuery.isSpellCheck()) {
|
||||
solrQuery.setParam(SpellingParams.SPELLCHECK_Q, query);
|
||||
|
Reference in New Issue
Block a user