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
|
* <p>
|
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 Name of the field, should match one of the field names defined under "fields" tag in schema.xml.
|
18
|
* @param value Value of the field, should be of same class type as defined by "type" attribute of the corresponding field in schema.xml.
|
19
|
*/
|
20
|
public void addField(String name, Object value);
|
21
|
|
22
|
/**
|
23
|
* Set a field with implied null value for boost.
|
24
|
*
|
25
|
* @param name name of the field to set
|
26
|
* @param value value of the field
|
27
|
*/
|
28
|
public void setField(String name, Object value);
|
29
|
|
30
|
/**
|
31
|
* Get the first value for a field.
|
32
|
*
|
33
|
* @param name name of the field to fetch
|
34
|
* @return first value of the field or null if not present
|
35
|
*/
|
36
|
public Object getFieldValue(String name);
|
37
|
|
38
|
/**
|
39
|
* Gets the field.
|
40
|
*
|
41
|
* @param field the field
|
42
|
* @return the field
|
43
|
*/
|
44
|
public IndexField getField(String field);
|
45
|
|
46
|
/**
|
47
|
* Remove a field from the document.
|
48
|
*
|
49
|
* @param name The field name whose field is to be removed from the document
|
50
|
* @return the previous field with <tt>name</tt>, or <tt>null</tt> if there was no field for <tt>key</tt>.
|
51
|
*/
|
52
|
public IndexField removeField(String name);
|
53
|
|
54
|
/**
|
55
|
* Get all the values for a field.
|
56
|
*
|
57
|
* @param name name of the field to fetch
|
58
|
* @return value of the field or null if not set
|
59
|
*/
|
60
|
public Collection<Object> getFieldValues(String name);
|
61
|
|
62
|
/**
|
63
|
* Get all field names.
|
64
|
*
|
65
|
* @return Set of all field names.
|
66
|
*/
|
67
|
public Collection<String> getFieldNames();
|
68
|
|
69
|
/**
|
70
|
* return a copy of index Document.
|
71
|
*
|
72
|
* @return the index document
|
73
|
*/
|
74
|
public IndexDocument deepCopy();
|
75
|
|
76
|
/**
|
77
|
* Gets the status.
|
78
|
*
|
79
|
* @return the status
|
80
|
*/
|
81
|
public Status getStatus();
|
82
|
|
83
|
/**
|
84
|
* The set status.
|
85
|
*
|
86
|
* @param status the status
|
87
|
* @return the index document
|
88
|
*/
|
89
|
public IndexDocument setStatus(Status status);
|
90
|
|
91
|
/**
|
92
|
* If there was an error building the document, it is described here.
|
93
|
*
|
94
|
* @return the error
|
95
|
*/
|
96
|
public Throwable getError();
|
97
|
|
98
|
/**
|
99
|
* Sets the error.
|
100
|
*
|
101
|
* @param error the error
|
102
|
* @return the index document
|
103
|
*/
|
104
|
public IndexDocument setError(final Throwable error);
|
105
|
|
106
|
/**
|
107
|
* Sets the ok status to the index document.
|
108
|
*
|
109
|
* @return the index document
|
110
|
*/
|
111
|
public IndexDocument setOK();
|
112
|
|
113
|
/**
|
114
|
* Sets the status marked to the index document.
|
115
|
*
|
116
|
* @return the index document
|
117
|
*/
|
118
|
public IndexDocument setMarked();
|
119
|
|
120
|
}
|