-->
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: MultiFieldQueryParser and fields with class names
PostPosted: Tue Mar 31, 2009 12:51 pm 
Newbie

Joined: Mon Mar 23, 2009 12:46 pm
Posts: 6
I think I'm almost done implementing hibernate search except for this one issue. The problem is I don't get any results if the fields I pass into the MultiFieldQueryParser include the class name. I get the expected results when the fields just include the field name.

Code:
String[] fields = {"bar.title", "foo.description", "foo.title", "pet.title"};
/*boostPerField<String,Float> is created Dynamically, the values are bar.title=2.0, foo.description=1.0, foo.title=2.0, pet.title=3.0
*/
    QueryParser parser = new MultiFieldQueryParser(fields.toArray(new String[fields.size()]),new SimpleAnalyzer(), boostPerField);
luceneQuery = parser.parse(searchPattern);
FullTextQuery query = entityManager.createFullTextQuery(luceneQuery, classes);


will give me no results, but if the fields = {title, description} then it'll work give me results but not in the order that i'd like. Is there any way to include the class name in the field? I want to have the ability to assign different boosts per field per class. Is there anyway to achieve this? I used the seam dvdstore example to model this code, so I would think it's possible. Thank you.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 01, 2009 5:26 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

per default the filed name is just the property name. The class name it not prefixed. The @Field annotation takes a name parameter where you can set your own field name if you want. However, the names are not related to the boost. I think you should have a look at the @Boost annotation in the online documentation. You can use @Boost at the @Field, method or class level. Placing it on class level for example will boost all indexed fields in this class.

--Hardy


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.