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";
    }

  • 相关阅读:
    英语阅读重点单词总结
    Redis 应用
    Python 列表[::-1]翻转
    golang数据类型
    golang变量
    k8s 容器控制台日志收集
    css显示模式
    css选择器
    css样式引入
    GIL锁
  • 原文地址:https://www.cnblogs.com/tang0125/p/12690172.html
Copyright © 2011-2022 走看看