首页 \ 问答 \ Nutch与Solr(Nutch versus Solr)

Nutch与Solr(Nutch versus Solr)

目前收集我应该使用Nutch与Solr的信息(域名 - 垂直网页搜索)。

你能建议我吗?


Currently collecting information where I should use Nutch with Solr (domain - vertical web search).

Could you suggest me?


原文:https://stackoverflow.com/questions/2818112
更新时间:2022-06-20 20:06

最满意答案

当然你可以这样做:

<% Html.Partial("_ListTodos", userTodos); %>

userTodos作为参数传递给部分助手。

你得到的错误是因为你返回的索引页面/视图与return View(todos);Index操作方法中。 Index页面需要一个LoginModel对象,而不是IEnumerable的待办事项对象。

<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master"
    Inherits="System.Web.Mvc.ViewPage<todo_moble_oauth.Models.LoginModel>" %>

要解决这个问题,你需要改变你传递todos的方式。 由于您的Index页面接收到LoginModel ,您可以像这样将Todos属性添加到此类中:

[Required]
[Display(Name = "User name")]
public string UserName { get; set; }

[Required]
[DataType(DataType.Password)]
[Display(Name = "Password")]
public string Password { get; set; }

[Display(Name = "Remember me?")]
public bool RememberMe { get; set; }

public IEnumerable<todo_moble_oauth.Models.todo> Todos { get; set; }

然后修改您的索引操作方法:

[AllowAnonymous]
public ActionResult Index()
{
    // if user is logged in, show todo list
    if (Request.IsAuthenticated)
    {
        //var currentUser = Membership.GetUser().ProviderUserKey;
        todosDataContext objLinq = new todosDataContext();
        var todos = objLinq.todos.Select(x => x);

        LoginModel model = new LoginModel();
        model.Todos = todos;

        return View(model);
    }

    return View();
}

在该视图中,请执行以下操作:

<% Html.Partial("_ListTodos", Model.Todos); %>

Sure you can do that:

<% Html.Partial("_ListTodos", userTodos); %>

Pass the userTodos as a parameter to the Partial helper.

The error you're getting is because you're returning a list of todos to the Index page/view with return View(todos); inside the Index action method. The Index page needs a LoginModel object instead of an IEnumerable of todo objects.

<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master"
    Inherits="System.Web.Mvc.ViewPage<todo_moble_oauth.Models.LoginModel>" %>

To solve this, you need to change the way you're passing the todos though. Since your Index page receives a LoginModel, you can add a Todos property to this class like this:

[Required]
[Display(Name = "User name")]
public string UserName { get; set; }

[Required]
[DataType(DataType.Password)]
[Display(Name = "Password")]
public string Password { get; set; }

[Display(Name = "Remember me?")]
public bool RememberMe { get; set; }

public IEnumerable<todo_moble_oauth.Models.todo> Todos { get; set; }

and then, modify your Index action method:

[AllowAnonymous]
public ActionResult Index()
{
    // if user is logged in, show todo list
    if (Request.IsAuthenticated)
    {
        //var currentUser = Membership.GetUser().ProviderUserKey;
        todosDataContext objLinq = new todosDataContext();
        var todos = objLinq.todos.Select(x => x);

        LoginModel model = new LoginModel();
        model.Todos = todos;

        return View(model);
    }

    return View();
}

In the view, do this:

<% Html.Partial("_ListTodos", Model.Todos); %>

相关问答

更多
  • 您的模型有公共字段但不包含公共属性,这些不一样。 改成: public class CustomerModel { [Required] public Guid Id {get; set;} [Required] public string Name {get; set;} [Required] public string Description {get; set;} } 默认的MVC模型绑定器将使用属性,而不是字段。 更多关于这里 - http:/ ...
  • 默认的ASP.NET MVC 4“Internet应用程序”项目模板附带一些默认的成员资格功能。 如果您搜索并更新下面的行,则会在您的数据库中创建成员资格表(如果它们尚不存在): WebSecurity.InitializeDatabaseConnection("DefaultConnection", "UserProfile", "UserId", "UserName", autoCreateTables: true); 更多信息: http://aaron-hoffman.blogspot.com/2 ...
  • 我最近发现自己需要完成相同的任务,并且像你一样,不想添加一堆javascript。 我正在使用MVC4,并且我可以说,似乎没有一种开箱即用的方法将模型的可枚举属性绑定到视图。 :( 但是,正如您在问题中所演示的那样, 可以从视图中的模型中检索可枚举属性。 诀窍是将更新恢复到控制器。 离开您的示例模型,您的视图可能看起来像这样(您不需要部分): @model MVCComplexObjects.Models.ComplexObject

    @Html.ActionLink("Create New", " ...

  • 相关文章

    更多
  • 集成Nutch和Solr
  • Nutch&Solr小计
  • nutch,solr集成在hadoop上
  • Lucene、Nutch、Solr
  • nutch安装,与solr整合
  • Nutch-2.2.1学习之七Nutch与Solr的集成
  • nutch
  • nutch2.1+ solr4.5 遇到的一个问题
  • nutch 1.5 & solr 4.0 warmup
  • Nutch和Solr的集成方案
  • 最新问答

    更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。