-->
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: Boost Factor on Embedded Object
PostPosted: Wed Sep 09, 2009 9:18 pm 
Newbie

Joined: Wed Sep 09, 2009 9:01 pm
Posts: 2
Hi All,

I overrided DefaultSimiliarity,

public class OwnSimiliary extends DefaultSimilarity {

public float idf(int doFreq, int numDocs) {
return 1.0f;
}

public float lengthNorm(String fieldname, int numTerms) {
return 1.0f;
}
}

public class Vehicle {

@Field(index = Index.TOKENIZED, store = Store.YES)
@Boost(1.0f)
private String carType;

@IndexEmbedded
private Set<Car> car;
}

public class Car {

@Field(index = Index.TOKENIZED, store = Store.YES)
@Boost(5.0f)
private String name;
}


I use the explain to get score details when querying "Vehicle"

for field "carType", the fieldNorm return "1" if records are matched (this is right to me)

But for field, "car.name", the fieldNorm return "a strange value(big value)" if records are matched.

I thought the fieldNorm of car.name should return "1" but it is not.

Can someone explain it to me? or tell me whether I'm in right track and show me some ways to solve it.

Thanks heap.


Top
 Profile  
 
 Post subject: Re: Boost Factor on Embedded Object
PostPosted: Fri Sep 11, 2009 6:07 am 
Hibernate Team
Hibernate Team

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

As far as i know the fieldNorm is defined as: getBoost(t.field in d) * lengthNorm(t.field in d)
This means the boost is a factor when calculating the field norm. Given that you use @Boost(5.0f) on
Car.name I would not expect the value to be 1.

--Hardy


Top
 Profile  
 
 Post subject: Re: Boost Factor on Embedded Object
PostPosted: Mon Oct 05, 2009 10:15 pm 
Newbie

Joined: Wed Sep 09, 2009 9:01 pm
Posts: 2
Hi,

Let me explain more clearly,

Hi All,

I overrided DefaultSimiliarity,

public class OwnSimiliary extends DefaultSimilarity {

public float idf(int doFreq, int numDocs) {
return 1.0f;
}

public float lengthNorm(String fieldname, int numTerms) {
return 1.0f;
}
}

public class Vehicle {

@Field(index = Index.TOKENIZED, store = Store.YES)
@Boost(1.0f)
private String carType;

@IndexEmbedded
private Set<Car> car;
}

public class Car {

@Field(index = Index.TOKENIZED, store = Store.YES)
@Boost(5.0f)
private String name;
}


Let say, we have indexed data,

carType:toyota
car.name:corolla

CarType:hyundai
car.name:getz

CarType:mitsubishi
car.name:lancer

I have overriden the DefaultSimiliarity class.

let say, I search for carType:toyota, it matched and fieldNorm should be 1 (make sense to me).

Again, if I search for car.name:corolla, it matched and fieldNorm should be 5 but hibernate search returns me a large value (it is puzzled me).

Is it because field norm calculation on embedded object is different from a normal way?

Thank you very much.


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.