Project

General

Profile

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

    
3
import org.springframework.beans.factory.annotation.Autowired;
4
import org.springframework.beans.factory.annotation.Required;
5

    
6
import eu.dnetlib.functionality.index.client.IndexClientException;
7
import eu.dnetlib.functionality.index.utils.MetadataReference;
8
import eu.dnetlib.miscutils.functional.UnaryFunction;
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 UnaryFunction<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
	@Required
35
	public void setReturnEmptyFields(final boolean returnEmptyFields) {
36
		this.returnEmptyFields = returnEmptyFields;
37
	}
38

    
39
	public boolean isReturnEmptyFields() {
40
		return returnEmptyFields;
41
	}
42

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

    
48
	@Required
49
	public void setIncludeRanking(final boolean includeRanking) {
50
		this.includeRanking = includeRanking;
51
	}
52

    
53
	public boolean isIncludeRanking() {
54
		return includeRanking;
55
	}
56

    
57
}
(7-7/15)