emmanuel wrote:
It should be possible, can you create a JIRA issue with a test case?
Yes it's possible. When I was creating a unit test class, I found where is the problem : FieldBridge !
For exemple, when we have a "Document" class with the field :
Quote:
@Field(index=Index.TOKENIZED, store=Store.YES)
@FieldBridge(impl = PaddedIntegerBridge.class)
private Integer largeur;
And we create a new "Document" object with largeur = null, no index file for this object was created.
This is my PaddedIntegerBridge class :
Quote:
public class PaddedIntegerBridge implements StringBridge
{
private static int PADDING = 10;
public String objectToString(Object object) {
return integerToString((Integer) object);
}
public static String integerToString(int entier)
{
String rawInteger = ""+entier;
if (rawInteger.length() > PADDING)
throw new RuntimeException("Try to pad on a number too big");
StringBuilder paddedInteger = new StringBuilder();
for (int padIndex = rawInteger.length(); padIndex < PADDING; padIndex++ )
{
paddedInteger.append('0');
}
return paddedInteger.append( rawInteger ).toString();
}
}