I’m fairly new to Hibernate, so please tell me if I missed out on some information which you require.
My Problem is if I search for a description with 1 Term like “detailed” or “Description” I get a result, but if I keep a whitespace in between (“detailed Description”) I get no results, how would I accomplish this?
I have the following (shortend) Class “Part”
@Entity
@Indexed
public class Part {
@FullTextField(projectable = Projectable.YES)
private String description;
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
And I have the following function inside a Dao Class
public List<Part> getParts() {
EntityManager entityManager;
SearchSession searchSession = Search.session(entityManager);
ConvertToBean<List<?>, Part> converter = new ConvertToBean<List<?>, Part>(Part.class);
return searchSession.search(Part.class).select( f -> f.composite(
converter,
f.field("description", String.class)
))
.where(f -> f.bool(b -> {
b.must(f.wildcard().field("description").matching(Util.withWildcard("detailed description")));
})).fetchHits(1000)
}
The persistence.xml includes all classes and the following properties
<properties>
<property name="jboss.as.jpa.providerModule" value="application" />
<property name="hibernate.search.configuration_property_checking.strategy" value="ignore"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
<property name="hibernate.show_sql" value="true"/>
</properties>