-->
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.  [ 2 posts ] 
Author Message
 Post subject: Hibernate Search indexing field ignoring characters ordering
PostPosted: Fri Oct 26, 2012 6:58 am 
Regular
Regular

Joined: Thu Jun 16, 2011 12:03 pm
Posts: 94
Hi all,

I was wondering if there is any way of indexing a field without some characters that i do not want to index.

I have titles like these:

-The book of my life
-[book x]
-'book of my life'

And I have these titles indexed in a untokenized field. But what I want is to sort the results, it does not work because of the [ or ' characters. I would like to remove some of these characters (I have more, this is just an example) at the moment of indexing the entity.

Is there any way of doing this?

I could do it with java replace method but I don't think this is the best solution.

this is my entity code:

Code:
@Indexed
public class TituloEntity implements Serializable, Auditable
{
   
   /** The Constant serialVersionUID. */
   private static final long serialVersionUID = 1L;

   /** The id titulo. */
   @DocumentId
   private int idTitulo;

   @Fields( {
       @Field(name = "titulo_untokenized", index = Index.UN_TOKENIZED),
       @Field(name = "titulo_untokenized_prueba", index = Index.UN_TOKENIZED, bridge = @FieldBridge(impl = TituloBridge.class)),
       @Field(name = "titulo", index = Index.TOKENIZED),
       @Field(name = "titulo_filter", analyzer=@Analyzer(definition="capsFilter"))
    } )
   private String titulo;






thanks everybody!


Top
 Profile  
 
 Post subject: Re: Hibernate Search indexing field ignoring characters ordering
PostPosted: Fri Oct 26, 2012 3:42 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi, you could use an analyzer which strips out the custom tokens and sort on it.

Just make sure the output of such an analyzer is made of a single token: a field to be sorted on requires to be a single token or you get very strange reults.

_________________
Sanne
http://in.relation.to/


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

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.