From 2e6aa641a1bc4bdbad704739749ad454cabeeb6e Mon Sep 17 00:00:00 2001 From: "Luiz Guilherme P. Santos" Date: Mon, 10 Feb 2014 23:55:35 -0200 Subject: [PATCH 1/7] Now view plugin is compatible with 0.90.11 version of elasticsearch. --- pom.xml | 3 +-- .../action/view/TransportViewAction.java | 25 +++++++++---------- .../action/view/ViewRequest.java | 2 -- .../org/elasticsearch/view/ViewContext.java | 12 ++++----- .../org/elasticsearch/view/ViewService.java | 15 ++++------- 5 files changed, 23 insertions(+), 34 deletions(-) diff --git a/pom.xml b/pom.xml index 3503967..9f5fa8c 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,7 @@ - 0.20.5 + 0.90.11 2.1.3.Final UTF-8 @@ -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)) From c6d646dd4474505c4e284b6ff4ada1220a636b40 Mon Sep 17 00:00:00 2001 From: "Luiz Guilherme P. Santos" Date: Tue, 11 Feb 2014 11:03:20 -0200 Subject: [PATCH 2/7] Change release location. --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 9f5fa8c..f4f6053 100644 --- a/pom.xml +++ b/pom.xml @@ -72,9 +72,9 @@ - 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 From 86a448b0899fa28579e45992b6159d68ad00e851 Mon Sep 17 00:00:00 2001 From: "Luiz Guilherme P. Santos" Date: Tue, 11 Feb 2014 11:18:20 -0200 Subject: [PATCH 3/7] [maven-release-plugin] prepare release elasticsearch-view-plugin-0.0.3 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f4f6053..496453c 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.github.tlrx elasticsearch-view-plugin - 0.0.3-SNAPSHOT + elasticsearch-view-plugin-0.0.3 jar elasticsearch-view-plugin From 0e7ea4fd9ffef6724ed1531965dc1aff7c9d8b15 Mon Sep 17 00:00:00 2001 From: "Luiz Guilherme P. Santos" Date: Tue, 11 Feb 2014 11:18:26 -0200 Subject: [PATCH 4/7] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 496453c..7068f65 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.github.tlrx elasticsearch-view-plugin - elasticsearch-view-plugin-0.0.3 + 0.0.4-SNAPSHOT jar elasticsearch-view-plugin From 3412593b13c0785a7911ba3c01a13ddc946d3105 Mon Sep 17 00:00:00 2001 From: "Luiz Guilherme P. Santos" Date: Tue, 11 Feb 2014 11:29:40 -0200 Subject: [PATCH 5/7] Change group id. --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 7068f65..28be08f 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 - com.github.tlrx + com.github.luizgpsantos elasticsearch-view-plugin 0.0.4-SNAPSHOT jar @@ -79,7 +79,7 @@ GitHub - https://github.com/tlrx/elasticsearch-view-plugin/issues/ + https://github.com/luizgpsantos/elasticsearch-view-plugin/issues/ From 6f0a99f7cd1a59ea20b1b7bdd073d0222239b6e6 Mon Sep 17 00:00:00 2001 From: "Luiz Guilherme P. Santos" Date: Tue, 11 Feb 2014 11:40:51 -0200 Subject: [PATCH 6/7] [maven-release-plugin] prepare release elasticsearch-view-plugin-0.0.4 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 28be08f..193914a 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.github.luizgpsantos elasticsearch-view-plugin - 0.0.4-SNAPSHOT + 0.0.4 jar elasticsearch-view-plugin From 73ae16aca74011d8e092675f1e48df1b935f6006 Mon Sep 17 00:00:00 2001 From: "Luiz Guilherme P. Santos" Date: Tue, 11 Feb 2014 11:40:57 -0200 Subject: [PATCH 7/7] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 193914a..4649133 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.github.luizgpsantos elasticsearch-view-plugin - 0.0.4 + 0.0.5-SNAPSHOT jar elasticsearch-view-plugin