-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate Search object to string bridge
PostPosted: Fri Jun 06, 2014 4:58 am 
Newbie

Joined: Wed May 21, 2014 4:23 am
Posts: 2
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)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.