On Tuesday 11 February 2003 07:48, Nellai wrote: > Hi! > > can anyone tell me how to calculate the % of relevance using Lucene.
Lucene's hit score is normalized float, ] 0.0, 1.0 ] (since 0.0 ones are never included). From there it's basic arithmetics (perhaps this could be included in FAQ , even though it is fairly trivial). The simples way would be: ... // get the search results, float score = hits.score(docNr); // between 0.0 and 1.0 (including 1.0) int pctScore = (int) (100.0f * score); Also note that it's not guaranteed that all searches have any 100% matching docs; for example when none of the docs matches all clauses, and clauses are combined with OR-query. Same may also happen (I think?) if best match for different sub-clauses is different? You may also want to normalize the score if you always want your top match to be 100% (or have some range that gets rounded up)... users are known to want silly features like that. :-) -+ Tatu +- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
