Project

General

Profile

1
package eu.dnetlib.clients.index.query;
2

    
3
import java.util.function.Function;
4

    
5
import eu.dnetlib.clients.index.client.IndexClientException;
6
import eu.dnetlib.clients.index.utils.MetadataReference;
7
import org.springframework.beans.factory.annotation.Autowired;
8
import org.springframework.beans.factory.annotation.Required;
9

    
10
public abstract class QueryResponseFactory<T> {
11

    
12
	/**
13
	 * tells to getBrowsingResults method if empty fields must be returned or not.
14
	 */
15
	protected boolean returnEmptyFields;
16

    
17
	/**
18
	 * force solr to return record ranking or not.
19
	 */
20
	protected boolean includeRanking;
21

    
22
	/**
23
	 * utility for highlighting.
24
	 */
25
	protected Function<String, String> highlightUtils;
26

    
27
	@Autowired
28
	protected BrowseAliases browseAliases;
29

    
30
	public abstract QueryResponseParser getQueryResponseParser(final IndexQueryResponse<T> queryRsp, final MetadataReference mdRef) throws IndexClientException;
31

    
32
	// /////////////////// setters and getters.
33

    
34
	public boolean isReturnEmptyFields() {
35
		return returnEmptyFields;
36
	}
37

    
38
	@Required
39
	public void setReturnEmptyFields(final boolean returnEmptyFields) {
40
		this.returnEmptyFields = returnEmptyFields;
41
	}
42

    
43
	@Required
44
	public void setHighlightUtils(final Function<String, String> highlightUtils) {
45
		this.highlightUtils = highlightUtils;
46
	}
47

    
48
	public boolean isIncludeRanking() {
49
		return includeRanking;
50
	}
51

    
52
	@Required
53
	public void setIncludeRanking(final boolean includeRanking) {
54
		this.includeRanking = includeRanking;
55
	}
56

    
57
}
(7-7/9)