[hibernate-issues] [Hibernate-JIRA] Commented: (HSEARCH-997) Add short numeric bridge

Sanne Grinovero (JIRA) noreply at atlassian.com
Thu Dec 1 10:52:19 EST 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-997?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44490#comment-44490 ] 

Sanne Grinovero commented on HSEARCH-997:
-----------------------------------------

Hi Mathieu,
thanks yes that would be nice to add.

One warning though: the combination of possible terms in a short is so limited that using a NumericField is likely overkill, a traditional conversion in String would perform better: in fact Lucene doesn't support conversion from short either, I'll need to convert it at least to an integer.

> Add short numeric bridge
> ------------------------
>
>                 Key: HSEARCH-997
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-997
>             Project: Hibernate Search
>          Issue Type: Improvement
>          Components: analyzer
>    Affects Versions: 4.0.0.Beta2
>            Reporter: Mathieu Lachance
>
> when indexing a collection of short value using the @IndexedEmbedded + @NumericField + @Field annotation combinaison, it will return the expected NumericIterableBridge.
> though when indexing a short value using the @NumericField + @Field annotation combinaison no bridge is associated with.
> here's my understanding of the issue :
> when guessing type in org.hibernate.search.bridge.impl.BridgeFactory::guessNumericFieldBridge, it will return null, and then throw an throw new SearchException( "Unable to guess FieldBridge for " + member.getName() ); since there's no ShortNumericBridge type exists.
> i guess the correct implementation of the non-existing ShortNumericBridge would be :
> public class ShortNumericFieldBridge extends NumericFieldBridge {
> 	public Object get(String name, Document document) {
> 		return Short.valueOf(document.getFieldable(name).stringValue());
> 	}
> }
> then add we would need to do is add the new implementation into the static numericField map.
> seem a nice addition to me, or is there something i missed somewhere ?
> thanks

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list