-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate Search Filter with Tokenized field
PostPosted: Wed Sep 28, 2011 4:25 pm 
Newbie

Joined: Wed Sep 28, 2011 4:19 pm
Posts: 2
I am using Hibernate search 3.3 to search a Lucene index. I have a filter I need to use on a certain field, but also make it TOKENIZED for full text search. What I have found is that when I have the field set to UN_TOKENIZED, the filter works and full text search doesn't, and when I have it set to TOKENIZED, full text search works and the filter doesn't.

POJO
Code:
@Field(name = "owningOrganization", index = Index.UN_TOKENIZED, store = Store.YES)
@FieldBridge(impl = OrganizationNameFieldBridge.class)
public Organization getOwningOrganization()
{

Filter
Code:
@Factory
public Filter getFilter()
{
    BooleanQuery query = new BooleanQuery();
    Term orgTerm = new Term("owningOrganization", userOrganization);
    Term activeTerm = new Term("currentStateIsActive", "1");
    query.add(new TermQuery(orgTerm), Occur.SHOULD);
    query.add(new TermQuery(activeTerm), Occur.SHOULD);
    return new CachingWrapperFilter(new QueryWrapperFilter(query));
}

When I enter search terms of
Code:
owningOrganization:"This is the exact value of an organization"
I get no results, but the filter works as desired. And opposite when I switch it to TOKENIZED.

Any suggestions?


Top
 Profile  
 
 Post subject: Re: Hibernate Search Filter with Tokenized field
PostPosted: Thu Sep 29, 2011 8:35 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
first hint: you're on the wrong forum :-) please use viewforum.php?f=9 for Hibernate Search related questions.

to address your question, you can use @Fields (not the plural form) to define multiple @Field: give them different field names and use one for each use case with a different set of options.

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


Top
 Profile  
 
 Post subject: Re: Hibernate Search Filter with Tokenized field
PostPosted: Thu Sep 29, 2011 9:08 am 
Newbie

Joined: Wed Sep 28, 2011 4:19 pm
Posts: 2
Thanks for the reply even though I was mistakenly in the wrong forum!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.