SearchHit Java API


(Adrian-2) #1

Hi,

I've seen that the SearchHit interface does not provide a method for accessing
a field using the common java naming conventions. Would it be possible to add
such a method with the name "getField"?

Thanks, Adrian

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(David Pilato) #2

It's not really a getter right?

SearchHit#field(String fieldName);

I assume that's probably the reason it was not modified to support getter/setter standard format.

Do you have any issue related to this?

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 9 sept. 2013 à 16:49, Adrian google@core.kyubu.de a écrit :

Hi,

I've seen that the SearchHit interface does not provide a method for accessing
a field using the common java naming conventions. Would it be possible to add
such a method with the name "getField"?

Thanks, Adrian

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Adrian-2) #3

On Mon, Sep 09, 2013 at 04:52:52PM +0200, David Pilato wrote:

David,

It's not really a getter right?
SearchHit#field(String fieldName);
I assume that's probably the reason it was not modified to support getter/setter standard format.
Do you have any issue related to this?

If you are using things like StringTemplate for accessing the objects, absence
of the getters makes it difficult to fetch the values.

Best, Adrian

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(David Pilato) #4

In that case, what parameter do you send in fieldName?

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 9 sept. 2013 à 17:06, Adrian google@core.kyubu.de a écrit :

On Mon, Sep 09, 2013 at 04:52:52PM +0200, David Pilato wrote:

David,

It's not really a getter right?
SearchHit#field(String fieldName);
I assume that's probably the reason it was not modified to support getter/setter standard format.
Do you have any issue related to this?

If you are using things like StringTemplate for accessing the objects, absence
of the getters makes it difficult to fetch the values.

Best, Adrian

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Adrian-2) #5

On Mon, Sep 09, 2013 at 05:10:05PM +0200, David Pilato wrote:

David,

In that case, what parameter do you send in fieldName?

The field name which is contained (as key) in the map from getFields.

Best, Adrian

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(David Pilato) #6

Sorry. I don't get it.
As you have the full map with getFields(), why not simply iterate other it? Or ask the map to give you the field you want?

Could you share with a Gist some code? It could help me to have a better picture here. I'm probably missing something.

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 9 sept. 2013 à 17:14, Adrian google@core.kyubu.de a écrit :

On Mon, Sep 09, 2013 at 05:10:05PM +0200, David Pilato wrote:

David,

In that case, what parameter do you send in fieldName?

The field name which is contained (as key) in the map from getFields.

Best, Adrian

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Adrian-2) #7

On Mon, Sep 09, 2013 at 05:27:06PM +0200, David Pilato wrote:

David,

As you have the full map with getFields(), why not simply iterate other it?
Or ask the map to give you the field you want?

Absolutely. I just wondered why almost all properties of SearchHit are
accessible using getters but field.

Could you share with a Gist some code? It could help me to have a better
picture here. I'm probably missing something.

If there would exist a getField(String fieldname) method access to the value
would be as follows, given a List of SearchHit is referenced as "hits":

<hits : { hit | < hit.fields.keys : { key | : <hit.field(key)> } > } >

in contrast to (which accesses the map value)

<hits : { hit | < hit.fields.keys : { key | : <hit.fields.(key)> } > } >

Best regards, Adrian

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #8