I'm trying querying child elements on RavenDB Embeded in .NET, text search working, but WhereBetweenOrEqual, WhereGreaterThan, WhereLessThan not working
我正在尝试查询嵌入在.NET中的RavenDB中的子元素,文本搜索工作,但WhereBetweenOrEqual,WhereGreaterThan,WhereLessThan不工作
My code :
我的代码:
public class Document
{
public string Id { set; get; }
public IEnumerable<Attribute> Attributes { set; get; }
}
public class Attribute
{
public string Key { set; get; }
public object Value { set; get; }
}
Abstract Indexing class
摘要索引类
public class Document_ByAttribute : AbstractIndexCreationTask<Document>
{
public Document_ByAttribute()
{
Map = documents => from doc in documents
select new
{
_ = doc.Attributes
.Select(attribute =>
CreateField(attribute.Key, attribute.Value, false, true))
};
}
}
This is Working
这是工作
public ActionResult Filter(string id)
{
var doc = _Session.Advanced.LuceneQuery<Document>("Document/ByAttribute").Search("Title", "*" + id + "*").ToList();
return Json(doc, JsonRequestBehavior.AllowGet);
}
This function is not Working
此功能不起作用
public ActionResult Price_Range(decimal min = 0, decimal max = 99999999)
{
var doc = _Session.Advanced.LuceneQuery<Document>("Document/ByAttribute").WhereBetweenOrEqual("Price", min, max).ToList();
return Json(doc, JsonRequestBehavior.AllowGet);
}
I've tried everything. I was not successful. Please help me. How can do?
我已经尝试了一切。我没有成功。请帮帮我。怎么办?
Thanks in advance.
提前致谢。
1 个解决方案
#1
0
The likely issue is the types. You are passing a decimal, but the value on the server is interpret in some other way (likely float or int). Make sure that those match.
可能的问题是类型。您传递的是小数,但服务器上的值是以其他方式解释的(可能是float或int)。确保那些匹配。
#1
0
The likely issue is the types. You are passing a decimal, but the value on the server is interpret in some other way (likely float or int). Make sure that those match.
可能的问题是类型。您传递的是小数,但服务器上的值是以其他方式解释的(可能是float或int)。确保那些匹配。