zoukankan      html  css  js  c++  java
  • es在实体类的注解

    @Document(indexName="zhunneng",type="plan")

    @Field(index = true, store = true, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word", type = FieldType.text)

    //搜索
    @RequestMapping("search")
    public String search(String keyword,@RequestParam(defaultValue="1")Integer pageNum ,@RequestParam(defaultValue="2")Integer pageSize ,Model model) {
    //需求,使用es做搜索
    //1.导入依赖(已经导入)
    //2.配置文件(让spring的配置加载es.xml)
    //3.修改xml,指定仓库接口包扫描位置,
    //4.编写仓库接口,继承ElasticSearchRepository的接口,就具备了CRUD的功能
    //5.在实体类上执行对应的库名表名,主键,搜索关键字(注解)
    //6.得把mysql的数据导入到es索引库
    //使用工具类搜索
    PageInfo<Plan> info = (PageInfo<Plan>) HLUtils.findByHighLight(elasticsearchTemplate, Plan.class, pageNum, pageSize, new String[] {"manager","name","content"}, "id", keyword);
    model.addAttribute("info", info);
    model.addAttribute("key", keyword);

    return "search";
    }

  • 相关阅读:
    Bookmarks_www2
    Linux系统各发行版镜像下载(持续更新)
    tiny-rtems-src
    rtems-os-source
    OpenRCT2-ext
    PAT甲级1004题解——并查集思想改
    PAT甲级1008水题飘过
    PAT甲级1007题解——贪心
    PAT甲级1006水题飘过
    PAT甲级1005水题飘过
  • 原文地址:https://www.cnblogs.com/tang0125/p/12690172.html
Copyright © 2011-2022 走看看