开发者

Get Score with NHibernate.Search

开发者 https://www.devze.com 2022-12-18 21:31 出处:网络
I\'m currently trying to use NHibernate.Se开发者_如何学Carch, but i need to get score for each results returned by the query.

I'm currently trying to use NHibernate.Se开发者_如何学Carch, 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);
0

精彩评论

暂无评论...
验证码 换一张
取 消