Note that such heterogeneous behavior could lead to problems when implementing
HSEARCH-2498 Open , because now the return type of setProjection() would depend on the number of arguments. One solutions would be to have two methods: one with a single parameter, and another with vararg parameters. The former would project to single objects, the other to arrays (even if there is only one field being projected on):
public FullTextQuery<Object> setProjection(String field);
public FullTextQuery<Object[]> setProjection(String ... field);
By default, we'd get the behavior suggested in this ticket, because the call query.setProjection("myField") would resolve to setProjection(String) (which is more specific than the other), if I remember correctly. But users passing multiple field names, or passing string arrays (even with only one element), would still get the old behavior. |