SearchException Constructor changed in 0.12.1? (were upgrading from 0.9.0)


(Gideon Kaplan) #1

Hi,
We have groovy code like this
public IndexType getType(Index index, String typeName) {
if (index == null || typeName == null) {
throw new SearchException("Index or type name provided was
null!")
}
IndexType returnType = index.indexTypes.find {
it.name == typeName
}

    return returnType
}

But now getting stacktraces like
2010-11-15 14:12:57,300 [http-8083-1] ERROR
errors.GrailsExceptionResolver - Could not find matching constructor
for: org.elasticsearch.search.SearchException(java.lang.String)
groovy.lang.GroovyRuntimeException: Could not find matching
constructor for:
org.elasticsearch.search.SearchException(java.lang.String)
at
com.ticketfly.search.SearchQueryService.getType(SearchQueryService.groovy:
283)
at com.ticketfly.search.SearchQueryService$getType.call(Unknown
Source)

Looking at the method sigs, its asking for a ShardTarget
How does once quickly create a ShardTarget programmatically (from w/in
the code)

package org.elasticsearch.search;

public static class SearchException extends
org.elasticsearch.ElasticSearchException {
private final org.elasticsearch.search.SearchShardTarget
shardTarget;

public SearchException(org.elasticsearch.search.SearchShardTarget

shardTarget, java.lang.String msg) { /* compiled code */ }

public SearchException(org.elasticsearch.search.SearchShardTarget

shardTarget, java.lang.String msg, java.lang.Throwable cause) { /*
compiled code */ }

public org.elasticsearch.search.SearchShardTarget shard() { /*

compiled code */ }
}

Seems like ShardTarget asks for a few things
public static class SearchShardTarget implements
org.elasticsearch.common.io.stream.Streamable, java.io.Serializable{
private java.lang.String nodeId;
private java.lang.String index;
private int shardId;

private SearchShardTarget() { /* compiled code */ }

public SearchShardTarget(java.lang.String nodeId, java.lang.String

index, int shardId) { /* compiled code */ }

Thanks
G


(Shay Banon) #2

Hi,

Its an internal exception in elasticsearch in terms of construction. You
can build it yourself (and put null/empty string in the node id), but its
not guaranteed that it won't change in the future (the construction of it).

-shay.banon

On Tue, Nov 16, 2010 at 12:21 AM, Gideon Kaplan gideonkaplan@gmail.comwrote:

Hi,
We have groovy code like this
public IndexType getType(Index index, String typeName) {
if (index == null || typeName == null) {
throw new SearchException("Index or type name provided was
null!")
}
IndexType returnType = index.indexTypes.find {
it.name == typeName
}

   return returnType

}

But now getting stacktraces like
2010-11-15 14:12:57,300 [http-8083-1] ERROR
errors.GrailsExceptionResolver - Could not find matching constructor
for: org.elasticsearch.search.SearchException(java.lang.String)
groovy.lang.GroovyRuntimeException: Could not find matching
constructor for:
org.elasticsearch.search.SearchException(java.lang.String)
at
com.ticketfly.search.SearchQueryService.getType(SearchQueryService.groovy:
283)
at com.ticketfly.search.SearchQueryService$getType.call(Unknown
Source)

Looking at the method sigs, its asking for a ShardTarget
How does once quickly create a ShardTarget programmatically (from w/in
the code)

package org.elasticsearch.search;

public static class SearchException extends
org.elasticsearch.ElasticSearchException {
private final org.elasticsearch.search.SearchShardTarget
shardTarget;

public SearchException(org.elasticsearch.search.SearchShardTarget
shardTarget, java.lang.String msg) { /* compiled code */ }

public SearchException(org.elasticsearch.search.SearchShardTarget
shardTarget, java.lang.String msg, java.lang.Throwable cause) { /*
compiled code */ }

public org.elasticsearch.search.SearchShardTarget shard() { /*
compiled code */ }
}

Seems like ShardTarget asks for a few things
public static class SearchShardTarget implements
org.elasticsearch.common.io.stream.Streamable, java.io.Serializable{
private java.lang.String nodeId;
private java.lang.String index;
private int shardId;

private SearchShardTarget() { /* compiled code */ }

public SearchShardTarget(java.lang.String nodeId, java.lang.String
index, int shardId) { /* compiled code */ }

Thanks
G


(Gideon Kaplan) #3

Thanks Shay,
I think were just going to roll our own search exception so were not
as tightly coupled, but thanks for the response
Gideon

On Nov 15, 2:46 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Hi,

Its an internal exception in elasticsearch in terms of construction. You
can build it yourself (and put null/empty string in the node id), but its
not guaranteed that it won't change in the future (the construction of it).

-shay.banon

On Tue, Nov 16, 2010 at 12:21 AM, Gideon Kaplan gideonkap...@gmail.comwrote:

Hi,
We have groovy code like this
public IndexType getType(Index index, String typeName) {
if (index == null || typeName == null) {
throw new SearchException("Index or type name provided was
null!")
}
IndexType returnType = index.indexTypes.find {
it.name == typeName
}

   return returnType

}

But now getting stacktraces like
2010-11-15 14:12:57,300 [http-8083-1] ERROR
errors.GrailsExceptionResolver - Could not find matching constructor
for: org.elasticsearch.search.SearchException(java.lang.String)
groovy.lang.GroovyRuntimeException: Could not find matching
constructor for:
org.elasticsearch.search.SearchException(java.lang.String)
at
com.ticketfly.search.SearchQueryService.getType(SearchQueryService.groovy:
283)
at com.ticketfly.search.SearchQueryService$getType.call(Unknown
Source)

Looking at the method sigs, its asking for a ShardTarget
How does once quickly create a ShardTarget programmatically (from w/in
the code)

package org.elasticsearch.search;

public static class SearchException extends
org.elasticsearch.ElasticSearchException {
private final org.elasticsearch.search.SearchShardTarget
shardTarget;

public SearchException(org.elasticsearch.search.SearchShardTarget
shardTarget, java.lang.String msg) { /* compiled code */ }

public SearchException(org.elasticsearch.search.SearchShardTarget
shardTarget, java.lang.String msg, java.lang.Throwable cause) { /*
compiled code */ }

public org.elasticsearch.search.SearchShardTarget shard() { /*
compiled code */ }
}

Seems like ShardTarget asks for a few things
public static class SearchShardTarget implements
org.elasticsearch.common.io.stream.Streamable, java.io.Serializable{
private java.lang.String nodeId;
private java.lang.String index;
private int shardId;

private SearchShardTarget() { /* compiled code */ }

public SearchShardTarget(java.lang.String nodeId, java.lang.String
index, int shardId) { /* compiled code */ }

Thanks
G


(system) #4