I'm using Infinispan 6.0.2 and Hibernate Search 4.4.0.
In my cache, there are some data which value is
hibernate_search_DSL (type String). When I use keyword search with
hibernate, it can't find the result with underscore (
hibernate_search_DSL).
I think in Hibernate
hibernate_search_DSL is just one word, so I wrote a String Bridge try to replace all "_"to " ", but it doesn't work.
Here is my class:
Code:
public class NormaliseValue implements StringBridge{
public String objectToString(Object object)
{
if(object == null)
throw new IllegalArgumentException("There is no value to normalise");
String value = object.toString();
value.replaceAll("_", " ");
return value;
}
}
And mapping index:
Code:
mapping.entity(Hibernate.class).indexed().providedId()
.property("value", ElementType.FIELD).field().bridge(NormaliseValue.class);
Is something wrong or there is any solution simpler to find result with underscore???
I also put this question on Stack Overflow(stackoverflow.com/questions/24061561/hibernate-search-object-to-string-bridge)