You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
String class is not declared in the getSortType method from the class ConvertionUtils.java
So, when you want to sort string you sort by score ( the default sort stategy).
We have a problem with the String sort type and this code help us to fix the problem.
public static int getSortType(Class clazz, String field)
throws SearchException {
java.lang.reflect.Field fi;
try {
fi = clazz.getField(field);
} catch (Exception e) {
String tok=field.substring(0, field.indexOf('_'));
if (tok.equals(field))throw new SearchException("The field " + field
+ " is not found on class " + clazz);
return getSortType(clazz, tok);
}
Class type = fi.getType();
if (type.equals(String.class))
return SortField.STRING_VAL;
if (type.equals(long.class) || type.equals(Long.class))
return SortField.LONG;
if (type.equals(int.class) || type.equals(Integer.class))
return SortField.INT;
if (type.equals(double.class) || type.equals(Double.class))
return SortField.DOUBLE;
if (type.equals(float.class) || type.equals(Float.class))
return SortField.FLOAT;
if (type.equals(short.class) || type.equals(Short.class))
return SortField.SHORT;
if (type.equals(byte.class) || type.equals(Byte.class))
return SortField.BYTE;
return SortField.SCORE;
}
The text was updated successfully, but these errors were encountered:
Hello,
String class is not declared in the getSortType method from the class ConvertionUtils.java
So, when you want to sort string you sort by score ( the default sort stategy).
We have a problem with the String sort type and this code help us to fix the problem.
The text was updated successfully, but these errors were encountered: