문제

I'm currently trying to use NHibernate.Search, but i need to get score for each results returned by the query.

Anyone know something about how to do that ?

Thanks.

도움이 되었습니까?

해결책

If you are using projections you can do this by having one of the properties that you are projecting to be a ProjectionConstants.SCORE reference. This will cause lucene to return values stored in the index than making a query to the database. The query will return an arraylist of object[] values instead of objects.

for example.

IFullTextQuery query = search.CreateFullTextQuery("query goes here");

query.SetProjection("FirstName", "LastName", ProjectionConstants.SCORE);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top