dspace-api: set search fields in Solr query only if we are interested in the actual search results

This commit is contained in:
Alan Orth
2025-04-13 17:36:35 +03:00
parent 4d67aec3bc
commit 3d133727e9

View File

@@ -861,6 +861,9 @@ public class SolrServiceImpl implements SearchService, IndexingService {
solrQuery.setQuery(query); solrQuery.setQuery(query);
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 // Add any search fields to our query. This is the limited list
// of fields that will be returned in the solr result // of fields that will be returned in the solr result
for (String fieldName : discoveryQuery.getSearchFields()) { for (String fieldName : discoveryQuery.getSearchFields()) {
@@ -871,6 +874,7 @@ public class SolrServiceImpl implements SearchService, IndexingService {
solrQuery.addField(SearchUtils.RESOURCE_ID_FIELD); solrQuery.addField(SearchUtils.RESOURCE_ID_FIELD);
solrQuery.addField(SearchUtils.RESOURCE_UNIQUE_ID); solrQuery.addField(SearchUtils.RESOURCE_UNIQUE_ID);
solrQuery.addField(STATUS_FIELD); solrQuery.addField(STATUS_FIELD);
}
if (discoveryQuery.isSpellCheck()) { if (discoveryQuery.isSpellCheck()) {
solrQuery.setParam(SpellingParams.SPELLCHECK_Q, query); solrQuery.setParam(SpellingParams.SPELLCHECK_Q, query);