Project

General

Profile

« Previous | Next » 

Revision 44419

fixed delete by version implementation in index service (refresh mode feeding)

View differences:

IndexFeedActorImpl.java
7 7

  
8 8
import eu.dnetlib.clients.index.model.document.IndexDocument;
9 9
import eu.dnetlib.clients.index.utils.IndexFieldUtility;
10
import eu.dnetlib.index.utils.IndexDateUtility;
10 11
import eu.dnetlib.utils.MetadataReference;
11 12
import eu.dnetlib.clients.index.utils.ServiceTools;
12 13
import eu.dnetlib.enabling.tools.DnetStreamSupport;
......
118 119
	 * @param dsId            the ds id
119 120
	 * @throws IndexServiceException the index service exception
120 121
	 */
121
	private void deleteByVersion(final IndexCollection indexCollection, final String dsId, final String cqlQuery) throws IndexServiceException {
122
		//final String cqlQuery = IndexFieldUtility.DS_VERSION + " < \"" + IndexDateUtility.getParsedDateField(version) + "\"";
123
		try {
124
			String luceneQuery = translator.getTranslatedQuery(cqlQuery).asLucene();
125
			indexCollection.deleteByQuery(luceneQuery, dsId);
126
		} catch (CQLParseException e) {
127
			throw new IndexServiceException("Cannot parse CQL query into lucene query: " + cqlQuery, e);
128
		} catch (IOException e) {
129
			throw new IndexServiceException("Cannot parse CQL query into lucene query: " + cqlQuery, e);
130
		}
131

  
122
	private void deleteByVersion(final IndexCollection indexCollection, final String dsId, final String version) throws IndexServiceException {
123
		indexCollection.deleteByQuery(String.format("%s:[* TO %s}", IndexFieldUtility.DS_VERSION, version), dsId);
132 124
	}
133 125

  
134 126
	/**

Also available in: Unified diff