Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions ElasticSearchClient.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ component accessors="true" extends="Base" {
}

public IndexRequest function prepareIndex(string index="", string type="", string id=""){
var index = new requests.IndexRequest(ClusterManager=getClusterManager());
index.setIndex(arguments.index);
index.setType(arguments.type);
index.setId(arguments.id);
return index;
var ix = new requests.IndexRequest(ClusterManager=getClusterManager());
ix.setIndex(arguments.index);
ix.setType(arguments.type);
ix.setId(arguments.id);
return ix;
}

public MappingRequest function prepareMapping(required string index, required string type, required elasticsearch.indexing.TypeMapping typeMapping){
var index = new requests.MappingRequest(ClusterManager=getClusterManager());
index.setIndex(arguments.index);
index.setType(arguments.type);
index.setBody(typeMapping.getJson());
return index;
var ix = new requests.MappingRequest(ClusterManager=getClusterManager());
ix.setIndex(arguments.index);
ix.setType(arguments.type);
ix.setBody(arguments.typeMapping.getJson());
return ix;
}

public BulkRequest function prepareBulk(boolean Transactional=false){
Expand Down
6 changes: 3 additions & 3 deletions requests/GetRequest.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ component accessors="true" {
property name="ClusterManager" type="ClusterManager";

public GetRequest function init(required ClusterManager ClusterManager){
variables.ClusterManager = arguments.ClusterManager
variables.ClusterManager = arguments.ClusterManager;
return this;
}

public GetResponse function execute(){
var _url = "/#getIndex()#/#getType()#/#getId()#";

if(getSourceOnly()){
_url = _url & "/_source"
if(NOT isNull(getSourceOnly())){
_url = _url & "/_source";
}

_url = _url & "?realtime=#getRealtime()#";
Expand Down
1 change: 1 addition & 0 deletions responses/GetResponse.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ component extends="Response" accessors="true" implements="IResponse" {
setExists(getBody()["exists"]);
}
if(getSuccess()){
setExists(true); // default does not work in CF9
if(structKeyExists(getBody(), "_source")){
setSource(getBody()["_source"]);
}
Expand Down
2 changes: 1 addition & 1 deletion responses/IResponse.cfc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
interface{
public void function handleResponse(){}
public void function handleResponse();
}
15 changes: 11 additions & 4 deletions responses/Response.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,18 @@ component accessors="true" implements="IResponse"{
public void function handleResponse(){

var _httpResponse = arguments[1];

setStatusCode(_httpResponse.status_code);
setStatus(_httpResponse.StatusCode);
setBody(deserializeJSON(_httpResponse.FileContent));

local.content = _httpResponse.FileContent;

if(getMetaData(local.content).getName() IS "java.io.ByteArrayOutputStream") {
local.content = _httpResponse.FileContent.toString();
}

setStatusCode(_httpResponse.Responseheader.Status_Code);
setStatus(_httpResponse.Responseheader.Explanation);
setBody(deserializeJSON(local.content));
setHeaders(_httpResponse.responseHeader);
setSuccess(false); // default does not work in CF9

if(getStatusCode() <= 206 && getStatusCode() >= 200){
setSuccess(true);
Expand Down