如何在Solr.net中使用最小值,最大值和平均值 [英] How to use Min,max and average with Solr.net
问题描述
我找到了 http://code.google.com/p/solrnet/wiki/统计链接.
但是我听不懂.
我想在solr查询中使用min,max类型的函数.
I want to use min,max kind of function with solr query.
我的查询(显示圆形和彩色D的最小,最大和平均价格以及净度FL和克拉重量.(此查询将根据用户的选择动态生成)
My query(Display min, max and average price of Round shape and color D and clarity FL and caratweight.(This query will be genarated based on user's selection dynamically)
(形状:圆形")与(颜色:"D")与(清晰度:"FL")与(克拉重量:[1至10])
(Shape:"Round") AND (Color:"D") AND (Clarity:"FL") AND (CaratWeight:[1 TO 10])
但是我该如何使用这种功能并选择特定的列.
But how can i use such kind of function and select specific column.
现在我有点近了...
Now i am somewhat nearer...
通过使用以下网址,我得到了最小,最大,计数和均值..我想要的东西. 但是它是xml格式.现在我要习惯.我想在我的asp.net代码后面使用此结果,并希望做进一步的计算.
By using following url, i am getting min,max,count and mean..things those i want. But its in xml format. Now i want to cusomize. I want to use this result in my asp.net code behind and want to do further computation.
http://localhost:8983/solr/coreMikisa/select/?q=*%3A*&version=2.2&start=0&rows=10&indent=on&stats=true&stats.field=Price
所以请回复..我怎么能得到??
So please reply.. how can i get???
推荐答案
http://localhost:8983/solr/coreMikisa/select/?q=*%3A*&version=2.2&start=0&rows=10&indent=on&stats=true&stats.field=Price
这可以在SolrNet中表示为:
This can be expressed in SolrNet as:
var statsParams = new StatsParameters();
statsParams.AddField("Price");
var results = solr.Query(SolrQuery.All, new QueryOptions {
Rows = 10,
Start = 0,
Stats = statsParams
});
// use results.Stats...
这篇关于如何在Solr.net中使用最小值,最大值和平均值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!