草庐IT

current_index

全部标签

Lucene 索引 : Store and indexing modes explained

我想我还是不理解lucene索引选项。下面的选项是Store.YesStore.No和Index.TokenizedIndex.Un_TokenizedIndex.NoIndex.No_Norms我不太了解商店选项。为什么您不想存储您的字段?标记化是拆分内容并删除干扰词/分隔符(如“和”、“或”等)我不知道规范是什么。如何存储标记化的值?如果我在“fieldName”中存储一个值“mystring”会怎样?为什么不查询fieldName:mystring返回什么? 最佳答案 商店.是表示该字段的值将存储在索引中商店号意味着该字段的值

c# - index.html 未显示为默认页面

我在.NETCore中创建了一个emptyWeb应用程序,在wwwroot中我有index.html默认情况下未加载页面,它仅在我明确调用它时加载。这是我的project.json{"version":"1.0.0-*","compilationOptions":{"emitEntryPoint":true},"dependencies":{"Microsoft.AspNet.Server.Kestrel":"1.0.0-rc1-final","Microsoft.AspNet.StaticFiles":"1.0.0-rc1-final"},"commands":{"web":"Mic

c# - 路由请求时 HttpContext.Current.Session 为 null

没有路由,HttpContext.Current.Session有没有,所以我知道StateServer正在工作中。当我发送请求时,HttpContext.Current.Session是null在路由页面中。我在IIS7.0上使用.NET3.5sp1,没有MVC预览。看来AcquireRequestState使用路由时永远不会触发,因此不会实例化/填充session变量。当我尝试访问Session变量时,出现此错误:base{System.Runtime.InteropServices.ExternalException}={"Sessionstatecanonlybeusedwhe

c# - 从不同线程访问 HttpContext.Current

我有一个C#ASP.NET应用程序,它启动了大约25个不同的线程,在一个名为SiteCrawler.cs的类中运行一些方法。在HttpContext.Current.Session中,我想保存用户搜索的结果,并在所有线程运行完毕后将其呈现给用户。我的问题是HttpContext.Current对象在生成的线程中为空,因为它在那里不存在。由于应用程序是多线程时的限制,我还有哪些其他选项可以在不使用session的情况下保存用户/session特定数据?我试图搜索Stackoverflow的每一寸空间以找到解决方案,但没有任何运气.... 最佳答案

c# - Entity Framework 代码优先 Fluent Api : Adding Indexes to columns

我正在运行EF4.2CF并希望在我的POCO对象中的某些列上创建索引。举个例子,假设我们有这个雇员类:publicclassEmployee{publicintEmployeeID{get;set;}publicstringEmployeeCode{get;set;}publicstringFirstName{get;set;}publicstringLastName{get;set;}publicDateTimeHireDate{get;set;}}我们经常通过他们的员工代码搜索员工,并且由于有很多员工,出于性能原因将其编入索引会很好。我们能否以某种方式使用流畅的API来做到这一点?

c# - 为什么等待后 HttpContext.Current 为空?

我有以下测试WebAPI代码,我没有在生产中使用WebAPI,但我之所以这样做是因为我对这个问题进行了讨论:WebAPIAsyncquestion无论如何,这是有问题的WebAPI方法:publicasyncTaskGet(intid){varx=HttpContext.Current;if(x==null){//notthrownthrownewArgumentException("HttpContext.Currentisnull");}awaitTask.Run(()=>{Task.Delay(500);id=3;});x=HttpContext.Current;if(x==nu

c# - "Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions"错误

为什么我收到错误:Templatescanbeusedonlywithfieldaccess,propertyaccess,single-dimensionarrayindex,orsingle-parametercustomindexerexpressions在此代码处:@modelIEnumerable@{ViewBag.Title="Index";Layout="~/Views/Shared/_PageLayout.cshtml";}Index@Html.ActionLink("CreateNew","Create")@foreach(variteminModel){@Html.

c# - 路由 : The current request for action [. ..] 在以下操作方法之间不明确

我有一个名为Browse.chtml的View,用户可以在其中输入搜索词,或将搜索词留空。输入搜索词时,我想将页面定向到http://localhost:62019/Gallery/Browse/{Searchterm}当没有输入任何内容时,我想将浏览器定向到http://localhost:62019/Gallery/Browse/Start/Here。当我尝试这样做时,出现错误:Thecurrentrequestforaction'Browse'oncontrollertype'GalleryController'isambiguousbetweenthefollowingacti

c# - 如何在 ASP.NET Core 中获取 HttpContext.Current?

这个问题在这里已经有了答案:AccessthecurrentHttpContextinASP.NETCore(7个答案)关闭6年前。我们目前正在使用ASP.NETCore重写/转换我们的ASP.NETWebForms应用程序。尽量避免重新设计。有一节我们在类库中使用HttpContext来检查当前状态。如何在.NETCore1.0中访问HttpContext.Current?varcurrent=HttpContext.Current;if(current==null){//dosomethinghere//stringconnection=Configuration.GetConne

c# - 在测试初始化​​方法中模拟 HttpContext.Current

我正在尝试将单元测试添加到我构建的ASP.NETMVC应用程序中。在我的单元测试中,我使用以下代码:[TestMethod]publicvoidIndexAction_Should_Return_View(){varcontroller=newMembershipController();controller.SetFakeControllerContext("TestUser");...}使用以下助手来模拟Controller上下文:publicstaticclassFakeControllerContext{publicstaticHttpContextBaseFakeHttpCo