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.
|