diff --git a/pom.xml b/pom.xml index 3503967..4649133 100644 --- a/pom.xml +++ b/pom.xml @@ -1,9 +1,9 @@ 4.0.0 - com.github.tlrx + com.github.luizgpsantos elasticsearch-view-plugin - 0.0.3-SNAPSHOT + 0.0.5-SNAPSHOT jar elasticsearch-view-plugin @@ -17,7 +17,7 @@ - 0.20.5 + 0.90.11 2.1.3.Final UTF-8 @@ -72,14 +72,14 @@ - git:git@github.com:tlrx/elasticsearch-view-plugin.git - scm:git:git@github.com:tlrx/elasticsearch-view-plugin.git - scm:git:git@github.com:tlrx/elasticsearch-view-plugin.git + git:git@github.com:luizgpsantos/elasticsearch-view-plugin.git + scm:git@github.com:luizgpsantos/elasticsearch-view-plugin.git + scm:git:git@github.com:luizgpsantos/elasticsearch-view-plugin.git GitHub - https://github.com/tlrx/elasticsearch-view-plugin/issues/ + https://github.com/luizgpsantos/elasticsearch-view-plugin/issues/ @@ -144,7 +144,6 @@ - diff --git a/src/main/java/org/elasticsearch/action/view/TransportViewAction.java b/src/main/java/org/elasticsearch/action/view/TransportViewAction.java index 73de55d..bbe9640 100644 --- a/src/main/java/org/elasticsearch/action/view/TransportViewAction.java +++ b/src/main/java/org/elasticsearch/action/view/TransportViewAction.java @@ -18,6 +18,11 @@ */ package org.elasticsearch.action.view; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.elasticsearch.ElasticSearchException; import org.elasticsearch.ElasticSearchIllegalArgumentException; import org.elasticsearch.ElasticSearchParseException; @@ -31,7 +36,6 @@ import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.metadata.MappingMetaData; import org.elasticsearch.cluster.routing.ShardIterator; -import org.elasticsearch.common.Strings; import org.elasticsearch.common.collect.ImmutableMap; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; @@ -43,15 +47,10 @@ import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import org.elasticsearch.view.exception.ElasticSearchViewNotFoundException; import org.elasticsearch.view.ViewContext; import org.elasticsearch.view.ViewResult; import org.elasticsearch.view.ViewService; - -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import org.elasticsearch.view.exception.ElasticSearchViewNotFoundException; public class TransportViewAction extends TransportShardSingleOperationAction { @@ -117,7 +116,7 @@ protected ViewResponse shardOperation(ViewRequest request, int shardId) throws E IndexShard indexShard = indexService.shardSafe(shardId); GetResult getResult = indexShard.getService().get(request.type(), request.id(), null, false); - if (!getResult.exists()) { + if (!getResult.isExists()) { throw new ElasticSearchIllegalArgumentException("Document not found, cannot render view"); } @@ -142,10 +141,10 @@ protected ViewResponse shardOperation(ViewRequest request, int shardId) throws E } // Set some org.elasticsearch.test.integration.views.mappings.data required for view rendering - viewContext.index(getResult.index()) - .type(getResult.type()) - .id(getResult.id()) - .version(getResult.version()) + viewContext.index(getResult.getIndex()) + .type(getResult.getType()) + .id(getResult.getId()) + .version(getResult.getVersion()) .source(getResult.sourceAsMap()); // Ok, let's render it with a ViewEngineService @@ -283,7 +282,7 @@ private ViewContext extract(Map sourceAsMap, String format) { } SearchResponse searchResponse = searchAction.execute(searchRequest).get(); - viewContext.queriesAndHits(queryName, searchResponse.hits()); + viewContext.queriesAndHits(queryName, searchResponse.getHits()); } catch (Exception e) { viewContext.queriesAndHits(queryName, null); diff --git a/src/main/java/org/elasticsearch/action/view/ViewRequest.java b/src/main/java/org/elasticsearch/action/view/ViewRequest.java index f96f065..c89e91f 100644 --- a/src/main/java/org/elasticsearch/action/view/ViewRequest.java +++ b/src/main/java/org/elasticsearch/action/view/ViewRequest.java @@ -20,7 +20,6 @@ import org.elasticsearch.action.support.single.shard.SingleShardOperationRequest; import org.elasticsearch.common.Nullable; -import org.elasticsearch.common.Required; public class ViewRequest extends SingleShardOperationRequest { @@ -59,7 +58,6 @@ public ViewRequest type(@Nullable String type) { /** * Sets the id of the document to fetch. */ - @Required public ViewRequest id(String id) { this.id = id; return this; diff --git a/src/main/java/org/elasticsearch/view/ViewContext.java b/src/main/java/org/elasticsearch/view/ViewContext.java index 135e82e..0899e54 100644 --- a/src/main/java/org/elasticsearch/view/ViewContext.java +++ b/src/main/java/org/elasticsearch/view/ViewContext.java @@ -18,18 +18,17 @@ */ package org.elasticsearch.view; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.elasticsearch.common.collect.ImmutableMap; import org.elasticsearch.common.util.concurrent.ConcurrentCollections; -import org.elasticsearch.index.get.GetField; import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.SearchHitField; import org.elasticsearch.search.SearchHits; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class ViewContext { private String lang; @@ -40,7 +39,6 @@ public class ViewContext { private String id; private Long version; private Map source; - private Map fields; private Map queries; public ViewContext(String lang, String view, String contentType) { diff --git a/src/main/java/org/elasticsearch/view/ViewService.java b/src/main/java/org/elasticsearch/view/ViewService.java index 7cf3697..9c79090 100644 --- a/src/main/java/org/elasticsearch/view/ViewService.java +++ b/src/main/java/org/elasticsearch/view/ViewService.java @@ -18,32 +18,27 @@ */ package org.elasticsearch.view; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStreamReader; +import java.util.Set; + import org.elasticsearch.common.collect.ImmutableMap; import org.elasticsearch.common.collect.ImmutableSet; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.io.Streams; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.util.concurrent.ConcurrentCollections; import org.elasticsearch.env.Environment; -import org.elasticsearch.script.CompiledScript; import org.elasticsearch.view.binary.BinaryViewEngineService; import org.elasticsearch.view.mvel.MvelViewEngineService; -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStreamReader; -import java.util.Set; -import java.util.concurrent.ConcurrentMap; - public class ViewService extends AbstractComponent { private final String defaultViewLang; private final ImmutableMap viewEngines; - private final ConcurrentMap staticCache = ConcurrentCollections.newConcurrentMap(); - public ViewService(Settings settings) { this(settings, new Environment(), ImmutableSet.builder() .add(new MvelViewEngineService(settings))