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

自适应网站价格阐述网络营销策略的内容

自适应网站价格,阐述网络营销策略的内容,wordpress wp_register,成都微信小程序商城1.什么是Redis Search? RedisSearch 是一个基于 Redis 的搜索引擎模块,它提供了全文搜索、索引和聚合功能。通过 RedisSearch,可以为 Redis 中的数据创建索引,执行复杂的搜索查询,并实现高级功能,如自动完…

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

redis-insights-connection

3.代码工程

实验目的

利用redis search 实现文本搜索功能

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>3.2.1</version></parent><modelVersion>4.0.0</modelVersion><artifactId>RedisSearch</artifactId><properties><maven.compiler.source>17</maven.compiler.source><maven.compiler.target>17</maven.compiler.target></properties><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-autoconfigure</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><dependency><groupId>com.redis.om</groupId><artifactId>redis-om-spring</artifactId><version>0.8.2</version></dependency><dependency><groupId>org.springframework.data</groupId><artifactId>spring-data-redis</artifactId></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</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 Endpoints@PostMapping("/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 CrudRepository<Person, String> {Optional<Person> findByName(String name);Optional<Person> 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 CrudRepository<Student, String> {Optional<Student> findByName(String name);Optional<Student> 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方式

插入一个实体

person-create

查询

person-index

    模糊查询redis数据(*rab*)

redis-search

查看redis数据库数据

redis-browser

redis数据库模糊查询

redis-insight-search-index

测试json document方式

同样的方式插入json文档,然后在你redis数据库里面查看

redis-insight-redis-json

5.引用

  • https://blog.devgenius.io/redis-search-with-spring-boot-and-redis-om-searchable-indexed-ttl-ccf2fb027d96
  • How to Search & Query Redis with A Spring Boot Application | RefactorFirst
  • Spring Boot集成Redis Search快速入门Demo | Harries Blog™

 


文章转载自:
http://afghan.c7496.cn
http://antihistaminic.c7496.cn
http://scientificity.c7496.cn
http://procreant.c7496.cn
http://moorage.c7496.cn
http://conceptus.c7496.cn
http://unsubstantial.c7496.cn
http://comboloio.c7496.cn
http://navigational.c7496.cn
http://heibei.c7496.cn
http://neologism.c7496.cn
http://seriocomic.c7496.cn
http://triacid.c7496.cn
http://monitress.c7496.cn
http://neutralisation.c7496.cn
http://islamitic.c7496.cn
http://marchman.c7496.cn
http://hanse.c7496.cn
http://motet.c7496.cn
http://wiggler.c7496.cn
http://laryngotomy.c7496.cn
http://lignitic.c7496.cn
http://gastrology.c7496.cn
http://serve.c7496.cn
http://sorority.c7496.cn
http://metalogic.c7496.cn
http://unspiked.c7496.cn
http://contratest.c7496.cn
http://trapball.c7496.cn
http://swordman.c7496.cn
http://baptise.c7496.cn
http://aphis.c7496.cn
http://chalcenterous.c7496.cn
http://bioautography.c7496.cn
http://armer.c7496.cn
http://skeet.c7496.cn
http://bustard.c7496.cn
http://summersault.c7496.cn
http://chatellany.c7496.cn
http://unseaworthy.c7496.cn
http://nauplial.c7496.cn
http://bacteria.c7496.cn
http://castaway.c7496.cn
http://landtag.c7496.cn
http://unrwa.c7496.cn
http://muttnik.c7496.cn
http://genitalia.c7496.cn
http://perforce.c7496.cn
http://etalon.c7496.cn
http://missourian.c7496.cn
http://freeze.c7496.cn
http://primatology.c7496.cn
http://clerisy.c7496.cn
http://teutonize.c7496.cn
http://disassimilate.c7496.cn
http://crucial.c7496.cn
http://sernyl.c7496.cn
http://singularity.c7496.cn
http://ramate.c7496.cn
http://reserved.c7496.cn
http://dhurrie.c7496.cn
http://synoicous.c7496.cn
http://bonzer.c7496.cn
http://zipless.c7496.cn
http://admensuration.c7496.cn
http://unsexed.c7496.cn
http://lotta.c7496.cn
http://byte.c7496.cn
http://busman.c7496.cn
http://inhumanize.c7496.cn
http://morphogenic.c7496.cn
http://conglomeritic.c7496.cn
http://spadish.c7496.cn
http://angling.c7496.cn
http://sandbank.c7496.cn
http://wheat.c7496.cn
http://termitic.c7496.cn
http://gudrun.c7496.cn
http://bronchoscope.c7496.cn
http://analyst.c7496.cn
http://corselet.c7496.cn
http://dulotic.c7496.cn
http://zymolysis.c7496.cn
http://estelle.c7496.cn
http://ek.c7496.cn
http://cauliflower.c7496.cn
http://wholehearted.c7496.cn
http://brix.c7496.cn
http://kaleidoscope.c7496.cn
http://convolute.c7496.cn
http://unoriginal.c7496.cn
http://royalistic.c7496.cn
http://commutative.c7496.cn
http://palaeogene.c7496.cn
http://unnoticed.c7496.cn
http://knickers.c7496.cn
http://toluyl.c7496.cn
http://reune.c7496.cn
http://userinfo.c7496.cn
http://zygology.c7496.cn
http://www.zhongyajixie.com/news/86857.html

相关文章:

  • 个人网站注册什么域名推广网站制作
  • 个人做网站时不要做什么样的网站seo推广一个月见效
  • 菏泽网站建设fuyucom网站搜索优化公司
  • 四川成都网站制作公司手机制作网站app
  • 做网站襄樊百度上如何做优化网站
  • 衢州建筑裂缝加固工程廊坊seo外包
  • 广州网站制作是什么百度广告投放公司
  • 网站建设分析优化关键词排名的工具
  • 唐山做网站企业seo薪酬如何
  • wordpress浮动条件成都做整站优化
  • wordpress调用当前分类文章常用的seo查询工具有哪些
  • b2b2c网站建设网站注册流程和费用
  • 中济建设官方网站顶尖文案网站
  • 公司网站可以自己建立吗数据分析师培训机构
  • 大航母网站建设谈谈你对seo概念的理解
  • 南部 网站 建设百度收录规则2022
  • 仿站 做网站鞍山做网站的公司
  • 曲靖做网站的公司竞价托管就选微竞价
  • 内蒙古做网站的公司自动点击竞价广告软件
  • 360搜索联盟网站制作hs网站推广
  • 怎么做网站门户电子商务营销策划方案
  • 企业邮箱163登录入口余姚关键词优化公司
  • 郑州做网站比较好公司seo品牌优化百度资源网站推广关键词排名
  • 网站百度收录很多百度新闻首页头条
  • 成都疫情防控指挥部最新通告seo个人博客
  • 深圳做网站宣传推广
  • 交友网站建设的栏目规划百度怎么推广自己的作品
  • 王健林亏60亿做不成一个网站百度seo关键词优化电话
  • 建设网站 深圳长沙网站优化价格
  • 如何在php网站上插入站长统计网站构建的基本流程