计算Lucene 5.0中的匹配项

时间:2015-05-16 11:22:00

标签: java lucene

我正在使用Lucene_50搜索字段。我想从我的术语中得到多少单词匹配该字段。例如,我的字段是" JavaServer Faces(JSF)是一个基于Java的Web应用程序框架,旨在简化基于Web的用户界面的开发集成。",我的查询术语是" java / jsf /框架/ doesnotexist"并且想要结果3因为只有" java"," jsf"和"框架"我希望得到每个文档中匹配的术语数量,你能否告诉我在Lucene 5.0中是否有一些简单的方法可以获得它?

    public partial class Test2 : DbMigration
    {
        public override void Up()
        {
            AddColumn("dbo.Recipes", "DeafultNumberOfServes", c => c.Int(nullable: false));
        }

        public override void Down()
        {
            DropColumn("dbo.Recipes", "DeafultNumberOfServes");
        }
    }

带有上述参数的输出是:

        protected override void Seed(MenuPlannerDBContext context)
        {
            context.Recipes.AddOrUpdate(
              new Recipe { RecipeID = 1, Description = "Recipe 1" },
              new Recipe { RecipeID = 2, Description = "Recipe 2" },
              new Recipe { RecipeID = 3, Description = "Recipe 3" }
            );

            var result = context.Recipes.Where(x => x.DeafultNumberOfServes == 0).ToList();
            result.ForEach(x => x.DeafultNumberOfServes = 4);
            context.SaveChanges();
        }

我想得到coord的值,比如1/2以上

0 个答案:

没有答案