Project

General

Profile

1
package eu.dnetlib.index;
2

    
3
import java.util.Collection;
4
import java.util.Iterator;
5

    
6
import eu.dnetlib.clients.index.model.document.IndexDocument;
7
import eu.dnetlib.rmi.provision.IndexServiceException;
8

    
9
/**
10
 * The Interface IndexCollection.
11
 */
12
public interface IndexCollection {
13

    
14
	/**
15
	 * Adds an input Document to the index.
16
	 *
17
	 * @param doc the doc
18
	 * @return the solr update response
19
	 * @throws IndexServiceException the index service exception
20
	 */
21
	boolean add(final IndexDocument doc) throws IndexServiceException;
22

    
23
	/**
24
	 * Adds all the documents to the index giving an iterator of input documents.
25
	 *
26
	 * @param docs the iterator of input documents
27
	 * @return the solr update response
28
	 * @throws IndexServiceException the index service exception
29
	 */
30
	boolean addAll(final Iterator<IndexDocument> docs) throws IndexServiceException;
31

    
32
	/**
33
	 * Adds the all.
34
	 *
35
	 * @param docs the docs
36
	 * @return the update response
37
	 * @throws IndexServiceException the index service exception
38
	 */
39
	boolean addAll(final Collection<IndexDocument> docs) throws IndexServiceException;
40

    
41
	/**
42
	 * Delete index.
43
	 *
44
	 * @param dsId the ds id
45
	 * @return true, if successful
46
	 * @throws IndexServiceException the index service exception
47
	 */
48
	boolean deleteIndex(final String dsId) throws IndexServiceException;
49

    
50
	/**
51
	 * Delete data from the index by query.
52
	 *
53
	 * @param query the query
54
	 * @param dsId  the ds id
55
	 * @return true, if successful
56
	 * @throws IndexServiceException the index service exception
57
	 */
58
	boolean deleteByQuery(final String query, final String dsId) throws IndexServiceException;
59

    
60
	/**
61
	 * Commit the data.
62
	 *
63
	 * @return true, if successful
64
	 * @throws IndexServiceException the index service exception
65
	 */
66
	boolean commit() throws IndexServiceException;
67

    
68
	/**
69
	 * Releases resources and closes connections.
70
	 */
71
	void shutdown();
72
}
(4-4/8)