From c4554fedad100cb82a5cab9c7efcd127d4c4d205 Mon Sep 17 00:00:00 2001 From: Jim Ferenczi Date: Wed, 4 May 2016 16:46:44 +0200 Subject: [PATCH] Fix build: restore illegalScorer still in use in ExpressionSearchScript --- .../elasticsearch/common/lucene/Lucene.java | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/core/src/main/java/org/elasticsearch/common/lucene/Lucene.java b/core/src/main/java/org/elasticsearch/common/lucene/Lucene.java index fcc443c57b6..3540b3712ae 100644 --- a/core/src/main/java/org/elasticsearch/common/lucene/Lucene.java +++ b/core/src/main/java/org/elasticsearch/common/lucene/Lucene.java @@ -638,6 +638,56 @@ public class Lucene { } } + /** + * Return a Scorer that throws an ElasticsearchIllegalStateException + * on all operations with the given message. + */ + public static Scorer illegalScorer(final String message) { + return new Scorer(null) { + @Override + public float score() throws IOException { + throw new IllegalStateException(message); + } + @Override + public int freq() throws IOException { + throw new IllegalStateException(message); + } + @Override + public int docID() { + throw new IllegalStateException(message); + } + @Override + public DocIdSetIterator iterator() { + throw new IllegalStateException(message); + } + }; + } + + /** + * Return a Scorer that throws an ElasticsearchIllegalStateException + * on all operations with the given message. + */ + public static Scorer illegalScorer(final String message) { + return new Scorer(null) { + @Override + public float score() throws IOException { + throw new IllegalStateException(message); + } + @Override + public int freq() throws IOException { + throw new IllegalStateException(message); + } + @Override + public int docID() { + throw new IllegalStateException(message); + } + @Override + public DocIdSetIterator iterator() { + throw new IllegalStateException(message); + } + }; + } + private static final class CommitPoint extends IndexCommit { private String segmentsFileName; private final Collection files;