Hi searchers,
I did a lot of indexation yet. And I met a use case that not satisfied me a lot : the “error” may be silent.
Indeed, when you simply annotate a method, with unconventional naming, you have to think that all your HSearch annotations on this method are ignored.
The method’s name must start with “isXXX” or “getXXXX”. I annotated for example this method :
@GenericField
@IndexingDependency(derivedFrom = {
@ObjectPath({@PropertyValue(propertyName = Acte_.REPRISE)}),
@ObjectPath({@PropertyValue(propertyName = Acte_.ACTE_MICEN), @PropertyValue(propertyName = ActeMicen_.SYNCHRONISE)})
})
public boolean mustBeMicenSynchronized() {
return this.acteMicen != null
&& Boolean.TRUE.equals(this.getReprise())
&& !Boolean.TRUE.equals(this.acteMicen.getSynchronise());
}
instead of doing like this :
public boolean mustBeMicenSynchronized() {
return this.acteMicen != null
&& Boolean.TRUE.equals(this.getReprise())
&& !Boolean.TRUE.equals(this.acteMicen.getSynchronise());
}
@GenericField
@IndexingDependency(derivedFrom = {
@ObjectPath({@PropertyValue(propertyName = Acte_.REPRISE)}),
@ObjectPath({@PropertyValue(propertyName = Acte_.ACTE_MICEN), @PropertyValue(propertyName = ActeMicen_.SYNCHRONISE)})
})
public boolean isMustBeMicenSynchronized() {
return mustBeMicenSynchronized();
}
So no error at present. The mass indexer do its job.
Moreover, I never query on this field named “mustBeMicenSynchronized” as I expect. So all is good. (although this index property never exist).
I did then my complex query, it results my projection object mapping the response.
This object never receive a “MustBeMicenSynchronized” property, so no mapping and it will be always null…always that the problem. In fact, the property was never indexed, my test :
If (Boolean.TRUE.equals(mustBeMicenSynchronized)) {
//...some operations
}
will be always false. The error was at indexation time.
What do you think of it ?