我有以下代码,我传递一个搜索值和一个分析器:
private static Query Query(string searchValue, StandardAnalyzer analyzer)
{
var queryParser = new QueryParser(Version.LUCENE_30, "Data", analyzer);
return queryParser.Parse(searchValue);
}
Run Code Online (Sandbox Code Playgroud)
Parse方法中抛出异常.
结果正确返回,所以一切正常; 这只是一个恼人的例外.我想忽略它吗?它是Lucene.Net的默认行为吗?我正在使用3.0.3版.
之前发现此帖子,但答案中提到的所有要点均不适用.索引没有损坏 - 在Luke.Net和Lucene的CheckIndex类中检查.写权限没有问题,因为我可以写入索引,而其他任何东西都没有使用索引文件.
我知道这是另一个与此问题相关的帖子:)
我正在尝试重写我的项目以使用 SignalR 自托管库(根据本教程),但现在无法通过此错误。
我初始化连接如下:
$.connection.hub.url = "http://localhost:8182/signalr";
$.connection.hub.logging = true;
var connection = $.connection.hub.start();
console.log(connection.state());
connection.done(function () {
console.log(connection.state());
[...] // initialising viewmodels in here...
});
Run Code Online (Sandbox Code Playgroud)
当第一个视图模型初始化时,我根据线程主题收到错误:
[17:29:14 GMT+0100 (GMT Daylight Time)] SignalR: Auto detected cross domain url. jquery.signalR-2.0.3.js:76
[17:29:14 GMT+0100 (GMT Daylight Time)] SignalR: Negotiating with 'http://localhost:8182/signalr/negotiate?clientProtocol=1.3'. jquery.signalR-2.0.3.js:76
pending main.js:218
[17:29:14 GMT+0100 (GMT Daylight Time)] SignalR: Attempting to connect to SSE endpoint 'http://localhost:8182/signalr/connect?transport=serverSentEvents&connection…pdQlpKjRBpUhB0PY4itVfHasSmixQAAAB0HA7hA9gYDflrhGockG%2FZR55tLg%3D%3D&tid=1'. jquery.signalR-2.0.3.js:76
[17:29:14 GMT+0100 (GMT Daylight Time)] SignalR: EventSource connected. jquery.signalR-2.0.3.js:76
[17:29:14 GMT+0100 (GMT …Run Code Online (Sandbox Code Playgroud) 从System.Data.Entity.SqlServer.SqlSpatialFunctions类定义:
包含将Linq中的SqlServer方法公开给实体的函数存根.
我知道Linq to Entities是专门提到的,但我想知道是否可以在我的后端代码中复制某些功能.
我有一个帐户模型,延迟加载多边形集合.每个Polygon都包含一个名为Location的DbGeography类型属性.
我试图让所有多边形都具有某些特定点(它还具有延迟加载属性Address,它具有名为Location的DbGeography类型属性).
我可以这样做:
var matchedPolygons =
account.Polygons.Where(
x =>
point.Address.Location.Intersects(x.Polygon.Location)).ToList();
Run Code Online (Sandbox Code Playgroud)
哪个工作正常.
为了尝试提高性能,我认为稍微减少Polygon数据是个好主意.
var matchedPolygons =
account.Polygons.Where(
x =>
point.Address.Location.Intersects(SqlSpatialFunctions.Reduce(x.Polygon.Location, 100))).ToList();
Run Code Online (Sandbox Code Playgroud)
但是,这会引发以下System.NotSupportedException异常:
只能从LINQ到实体调用此函数.
我知道我可以使用上面的Reduce方法直接从我的存储库层检索多边形,但由于我正在使用延迟加载并且已经可以使用多边形集合,我想在这个阶段可能有一种使用SqlSpatialFunctions的方法.
自从安装ReSharper 9以来,我注意到它现在突出显示了类型强制发生的部分javascript代码:
'==' tries to coerce values before comparing them which can lead to some unexpected results
Run Code Online (Sandbox Code Playgroud)
是否可以禁用这些警告?我已经快速查看了Resharper - >选项 - >代码编辑 - > Javascript,但无法找到我在任何地方寻找的选项.
我有一个应用程序,它处理和重新调整图像大小和偶尔在长迭代期间我得到OutOfMemoryException.
我将我的图像作为文件流存储在数据库中,在处理过程中我需要将它们保存到临时物理位置.
我的模特:
[Table("Car")]
public class Car
{
[... some fields ...]
public virtual ICollection<CarPhoto> CarPhotos { get; set; }
}
[Table("CarPhoto")]
public class CarPhoto
{
[... some fields ...]
public Guid Key { get; set; }
[Column(TypeName = "image")]
public byte[] Binary { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
处理看起来大致如下:
foreach (var car in cars)
{
foreach (var photo in car.CarPhotos)
{
using (var memoryStream = new MemoryStream(photo.Binary))
{
using (var image = Image.FromStream(memoryStream)) // this is where the exception is …Run Code Online (Sandbox Code Playgroud) 与此帖相似......
这是我的属性视图模型:
function propertyViewModel() {
var self = this;
self.propertyTypeList = ko.observableArray([]);
self.selectedPropertyType = ko.observable();
}
Run Code Online (Sandbox Code Playgroud)
这是我的属性类型模型:
function propertyTypeModel(id, name) {
this.Id = ko.observable(id);
this.Name = ko.observable(name);
}
Run Code Online (Sandbox Code Playgroud)
我使用signalR从数据库中获取数据,并在成功时调用以下客户端函数:
connection.client.populatePropertyTypeList = function (propertyTypeList) {
var mappedTypes = $.map(propertyTypeList, function (item) {
return new propertyTypeModel(item.Id, item.Name);
});
self.propertyTypeList(mappedTypes);
};
Run Code Online (Sandbox Code Playgroud)
和:
connection.client.populatePropertyDetails = function (property) {
self.selectedPropertyType(new propertyTypeModel(property.PropertyType.Id, property.PropertyType.Name));
};
Run Code Online (Sandbox Code Playgroud)
第一个使用所有可能的属性类型填充可观察数组,第二个获取相关属性类型并将其绑定到selectedPropertyType.
一切都按预期工作,直到我尝试引入下拉列表并使用selectedPropertyType的名称预先填充它,如下所示:
<select data-bind="options: propertyTypeList, optionsText: 'Name', value: selectedPropertyType"></select>
Run Code Online (Sandbox Code Playgroud)
这使得我的可观察对象(selectedPropertyType)将其值更改为列表中的第一个可用选项.我的理解是,虽然渲染了这个列表,但还没有填充propertyTypeList并导致selectedPropertyType默认为第一个可用值,但是为什么Knockout在调用connection.client.populatePropertyDetails时不更新对象?
如果我引入一个仅包含Id的新对象,我可以将选择列表绑定到Id,但是我希望将它绑定到整个selectedPropertyType对象.可能吗?
由于Azure 存储帐户上的静态网站功能不再处于预览模式,是否可以通过编程方式设置此选项(通过 Powershell Az 命令/Azure CLI)?
目前我能看到的唯一方法是在 UI 中手动执行:
c# ×3
javascript ×2
azure ×1
image ×1
knockout.js ×1
linq ×1
lucene.net ×1
resharper ×1
signalr ×1
spatial ×1
sql-server ×1