当前位置: 首页 > news >正文

关键词排名提高seo软件服务

关键词排名提高,seo软件服务,安卓应用市场哪个好,微信微商城平台1.什么是Redis Search#xff1f; RedisSearch 是一个基于 Redis 的搜索引擎模块#xff0c;它提供了全文搜索、索引和聚合功能。通过 RedisSearch#xff0c;可以为 Redis 中的数据创建索引#xff0c;执行复杂的搜索查询#xff0c;并实现高级功能#xff0c;如自动完… 1.什么是Redis Search RedisSearch 是一个基于 Redis 的搜索引擎模块它提供了全文搜索、索引和聚合功能。通过 RedisSearch可以为 Redis 中的数据创建索引执行复杂的搜索查询并实现高级功能如自动完成、分面搜索和排序。利用 Redis 的高性能特点RedisSearch 可以实现高效的搜索和实时分析。对于微服务架构来说RedisSearch 可以作为搜索服务的一部分提供快速、高效的搜索能力对于提高用户体验和性能具有重要的意义。 2.环境搭建 Docker Compose version: 3 services:redis:image: redis/redis-stackcontainer_name: redisports:- 6379:6379redis-insight:image: redislabs/redisinsightcontainer_name: redis-insightports:- 8001:8001 Run following command: docker-compose up -d 3.代码工程 实验目的 利用redis search 实现文本搜索功能 pom.xml ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdparentgroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-parent/artifactIdversion3.2.1/version/parentmodelVersion4.0.0/modelVersionartifactIdRedisSearch/artifactIdpropertiesmaven.compiler.source17/maven.compiler.sourcemaven.compiler.target17/maven.compiler.target/propertiesdependenciesdependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-web/artifactId/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-autoconfigure/artifactId/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-test/artifactIdscopetest/scope/dependencydependencygroupIdcom.redis.om/groupIdartifactIdredis-om-spring/artifactIdversion0.8.2/version/dependencydependencygroupIdorg.springframework.data/groupIdartifactIdspring-data-redis/artifactId/dependencydependencygroupIdorg.projectlombok/groupIdartifactIdlombok/artifactId/dependency/dependencies /project controller package com.et.controller;import com.et.redis.document.Student; import com.et.redis.document.StudentRepository; import com.et.redis.hash.Person; import com.et.redis.hash.PersonRepository; import jakarta.websocket.server.PathParam; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*;RestController public class WebController {private PersonRepository personRepository;private StudentRepository studentRepository;public WebController(PersonRepository personRepository, StudentRepository studentRepository) {this.personRepository personRepository;this.studentRepository studentRepository;}PostMapping(/person)public Person save(RequestBody Person person) {return personRepository.save(person);}GetMapping(/person)public Person get(PathParam(name) String name, PathParam(searchLastName) String searchLastName) {if (name ! null)return this.personRepository.findByName(name).orElseThrow(() - new RuntimeException(person not found));if (searchLastName ! null)return this.personRepository.searchByLastName(searchLastName).orElseThrow(() - new RuntimeException(person not found));return null;}// ---- Student EndpointsPostMapping(/student)public Student saveStudent(RequestBody Student student) {return studentRepository.save(student);}GetMapping(/student)public Student getStudent(PathParam(name) String name, PathParam(searchLastName) String searchLastName) {if (name ! null)return this.studentRepository.findByName(name).orElseThrow(() - new RuntimeException(Student not found));if (searchLastName ! null)return this.studentRepository.searchByLastName(searchLastName).orElseThrow(() - new RuntimeException(Student not found));return null;}ExceptionHandler(value RuntimeException.class)public ResponseEntity handleError(RuntimeException e) {return ResponseEntity.status(HttpStatus.NOT_FOUND).body(e.getMessage());}} RedisHash 方式 package com.et.redis.hash;import com.redis.om.spring.annotations.Indexed; import com.redis.om.spring.annotations.Searchable; import org.springframework.data.annotation.Id; import org.springframework.data.redis.core.RedisHash;RedisHash public class Person {Idprivate String id;Indexedprivate String name;Searchableprivate String lastName;public String getId() {return id;}public void setId(String id) {this.id id;}public String getName() {return name;}public void setName(String name) {this.name name;}public String getLastName() {return lastName;}public void setLastName(String lastName) {this.lastName lastName;} } package com.et.redis.hash;import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository;import java.util.Optional;Repository public interface PersonRepository extends CrudRepositoryPerson, String {OptionalPerson findByName(String name);OptionalPerson searchByLastName(String name); } Document 方式 package com.et.redis.document;import com.redis.om.spring.annotations.Document; import com.redis.om.spring.annotations.Indexed; import com.redis.om.spring.annotations.Searchable; import org.springframework.data.annotation.Id;Document public class Student {Idprivate String id;Indexedprivate String name;Searchableprivate String lastName;public String getId() {return id;}public void setId(String id) {this.id id;}public String getName() {return name;}public void setName(String name) {this.name name;}public String getLastName() {return lastName;}public void setLastName(String lastName) {this.lastName lastName;} } package com.et.redis.document;import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository;import java.util.Optional;Repository public interface StudentRepository extends CrudRepositoryStudent, String {OptionalStudent findByName(String name);OptionalStudent searchByLastName(String name); } DemoApplication package com.et;import com.redis.om.spring.annotations.EnableRedisDocumentRepositories; import com.redis.om.spring.annotations.EnableRedisEnhancedRepositories; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; EnableRedisDocumentRepositories(basePackages com.et.redis.document) EnableRedisEnhancedRepositories(basePackages com.et.redis.hash) SpringBootApplication public class DemoApplication {public static void main(String[] args) {SpringApplication.run(DemoApplication.class, args);} } application.yaml server:port: 8088 spring:redis:host: localhostport: 6379 只是一些关键代码所有代码请参见下面代码仓库 代码仓库 https://github.com/Harries/springboot-demo(redis search) 4.测试 启动Spring boot应用 测试hash方式 插入一个实体 查询 模糊查询redis数据*rab* 查看redis数据库数据 redis数据库模糊查询 测试json document方式 同样的方式插入json文档然后在你redis数据库里面查看 5.引用 https://blog.devgenius.io/redis-search-with-spring-boot-and-redis-om-searchable-indexed-ttl-ccf2fb027d96How to Search Query Redis with A Spring Boot Application | RefactorFirstSpring Boot集成Redis Search快速入门Demo | Harries Blog™
http://www.hkea.cn/news/14272378/

相关文章:

  • 买网站服务器要多少钱wordpress 文章 分类 页面
  • 做网站银川保险网上预约
  • 网站美化的目标广东工程建设咨询有限公司网站
  • 网站建设背景分析论文哈尔滨网站建立公司
  • 霸州市网站建设电子商务网站建设与维护李建忠下载
  • 网站建设万首先金手指14wordpress二维码手工
  • 大学生网站建设方案温州网站开发流程
  • 网站焦点图怎么做搜索引擎优化seo专员
  • 校内二级网站建设整改方案同ip网站做301
  • 医院网站开发公司企信网查询
  • asp网站镜像代码免费的编程自学软件
  • 马家堡网站建设旅游网络营销方式
  • 媒体网站网页设计做外国购物网站需要交税吗
  • 做网站能挣钱么网站用户体验比较
  • 企业网站建设_秒搜软件开发工程师是程序员吗
  • 免费做网站网站有人哪些nodejs适合网站开发
  • 网站鼠标特效代码广州深圳做网站
  • 石家庄网站定制制作邹平网站建设公司报价
  • 河北建设厅网站打不开是什么原因天津网站优化
  • seo知名公司企业网站关键字优化
  • 邯郸网站改版费用wordpress 图片相册
  • 公司网站怎么注册铜川微网站建设
  • 自己电脑如何做网站服务器沧州南皮网站建设公司
  • 网站为何站长统计上海建智建设工程咨询
  • 潜江网站设计公司东莞网站设计费用
  • 课题组研究网站怎么做wordpress登录查看
  • 企业网站空间选择桂林互联网
  • 阿里云怎么做静态网站软文世界平台
  • 网站seo标题优化技巧网站空间支付方式
  • 为什么访问外国网站速度慢seo专业学校