Remove unused insert method from secondary index interface

The `insert` method is not used anywhere.  The `replace` method is
used instead.

Change-Id: Ie47253149cacde9a0824e4dee4d80313acd33188
This commit is contained in:
David Pursehouse
2014-07-17 12:12:50 +09:00
parent da5e5e76a1
commit 7bf7e49621
4 changed files with 3 additions and 58 deletions

View File

@@ -279,26 +279,6 @@ public class LuceneChangeIndex implements ChangeIndex {
return schema;
}
@SuppressWarnings("unchecked")
@Override
public void insert(ChangeData cd) throws IOException {
Term id = QueryBuilder.idTerm(cd);
Document doc = toDocument(cd);
try {
if (cd.change().getStatus().isOpen()) {
Futures.allAsList(
closedIndex.delete(id),
openIndex.insert(doc)).get();
} else {
Futures.allAsList(
openIndex.delete(id),
closedIndex.insert(doc)).get();
}
} catch (OrmException | ExecutionException | InterruptedException e) {
throw new IOException(e);
}
}
@SuppressWarnings("unchecked")
@Override
public void replace(ChangeData cd) throws IOException {

View File

@@ -38,24 +38,13 @@ public interface ChangeIndex {
/** Close this index. */
public void close();
/**
* Insert a change document into the index.
* <p>
* Results may not be immediately visible to searchers, but should be visible
* within a reasonable amount of time.
*
* @param cd change document
*
* @throws IOException if the change could not be inserted.
*/
public void insert(ChangeData cd) throws IOException;
/**
* Update a change document in the index.
* <p>
* Semantically equivalent to deleting the document and reinserting it with
* new field values. Results may not be immediately visible to searchers, but
* should be visible within a reasonable amount of time.
* new field values. A document that does not already exist is created. Results
* may not be immediately visible to searchers, but should be visible within a
* reasonable amount of time.
*
* @param cd change document
*

View File

@@ -67,11 +67,6 @@ class FakeIndex implements ChangeIndex {
this.schema = schema;
}
@Override
public void insert(ChangeData cd) {
throw new UnsupportedOperationException();
}
@Override
public void replace(ChangeData cd) {
throw new UnsupportedOperationException();

View File

@@ -146,25 +146,6 @@ class SolrChangeIndex implements ChangeIndex, LifecycleListener {
stop();
}
@Override
public void insert(ChangeData cd) throws IOException {
String id = cd.getId().toString();
SolrInputDocument doc = toDocument(cd);
try {
if (cd.change().getStatus().isOpen()) {
closedIndex.deleteById(id);
openIndex.add(doc);
} else {
openIndex.deleteById(id);
closedIndex.add(doc);
}
} catch (OrmException | SolrServerException e) {
throw new IOException(e);
}
commit(openIndex);
commit(closedIndex);
}
@Override
public void replace(ChangeData cd) throws IOException {
String id = cd.getId().toString();