Project

General

Profile

1
package eu.dnetlib.clients.index.model.document;
2

    
3
import java.util.Collection;
4

    
5
/**
6
 * The Interface IndexDocument.
7
 */
8
public interface IndexDocument {
9

    
10
	/**
11
	 * Adds a field with the given name, value and boost. If a field with the name already exists, then the given value is appended to the
12
	 * value of that field, with the new boost. If the value is a collection, then each of its values will be added to the field.
13
	 * 
14
	 * The class type of value and the name parameter should match schema.xml. schema.xml can be found in conf directory under the solr home
15
	 * by default.
16
	 * 
17
	 * @param name
18
	 *            Name of the field, should match one of the field names defined under "fields" tag in schema.xml.
19
	 * @param value
20
	 *            Value of the field, should be of same class type as defined by "type" attribute of the corresponding field in schema.xml.
21
	 */
22
	public void addField(String name, Object value);
23

    
24
	/**
25
	 * Set a field with implied null value for boost.
26
	 * 
27
	 * @param name
28
	 *            name of the field to set
29
	 * @param value
30
	 *            value of the field
31
	 */
32
	public void setField(String name, Object value);
33

    
34
	/**
35
	 * Get the first value for a field.
36
	 * 
37
	 * @param name
38
	 *            name of the field to fetch
39
	 * @return first value of the field or null if not present
40
	 */
41
	public Object getFieldValue(String name);
42

    
43
	/**
44
	 * Gets the field.
45
	 * 
46
	 * @param field
47
	 *            the field
48
	 * @return the field
49
	 */
50
	public IndexField getField(String field);
51

    
52
	/**
53
	 * Remove a field from the document.
54
	 * 
55
	 * @param name
56
	 *            The field name whose field is to be removed from the document
57
	 * @return the previous field with <tt>name</tt>, or <tt>null</tt> if there was no field for <tt>key</tt>.
58
	 */
59
	public IndexField removeField(String name);
60

    
61
	/**
62
	 * Get all the values for a field.
63
	 * 
64
	 * @param name
65
	 *            name of the field to fetch
66
	 * @return value of the field or null if not set
67
	 */
68
	public Collection<Object> getFieldValues(String name);
69

    
70
	/**
71
	 * Get all field names.
72
	 * 
73
	 * @return Set of all field names.
74
	 */
75
	public Collection<String> getFieldNames();
76

    
77
	/**
78
	 * return a copy of index Document.
79
	 * 
80
	 * @return the index document
81
	 */
82
	public IndexDocument deepCopy();
83

    
84
	/**
85
	 * Gets the status.
86
	 * 
87
	 * @return the status
88
	 */
89
	public Status getStatus();
90

    
91
	/**
92
	 * The set status.
93
	 * 
94
	 * @param status
95
	 *            the status
96
	 * @return the index document
97
	 */
98
	public IndexDocument setStatus(Status status);
99

    
100
	/**
101
	 * If there was an error building the document, it is described here.
102
	 * 
103
	 * @return the error
104
	 */
105
	public Throwable getError();
106

    
107
	/**
108
	 * Sets the error.
109
	 * 
110
	 * @param error
111
	 *            the error
112
	 * @return the index document
113
	 */
114
	public IndexDocument setError(final Throwable error);
115

    
116
	/**
117
	 * Sets the ok status to the index document.
118
	 * 
119
	 * @return the index document
120
	 */
121
	public IndexDocument setOK();
122

    
123
	/**
124
	 * Sets the status marked to the index document.
125
	 * 
126
	 * @return the index document
127
	 */
128
	public IndexDocument setMarked();
129

    
130
}
(2-2/4)