使用es实现全文检索并且高亮显示

ElasticSearch——全文搜索引擎 一、为什么需要全文搜索引擎? 首先先来了解一个概念,在我们生活中一般来说有两种数据:结构化数据、非结构化数据 结构化数据:指具有固定格式或有限长度的数据,如数据库,元数据等。 非结构化数据: 非结构化数据又可称为全文数据,指不定长或无固定格式的数据,如邮件,word文档等。 对于结构化数据我们可以直接从数据库查询,而对于非结构化的数据此时就要用到全文检索的方式查询,比如对一个文档或者网页中的内容文本每个词建立一个索引,把这些非结构化的变成结构化的方式然后来查询。 全文搜索引擎百度百科定义:全文搜索引擎是目前 阅读详情

背景

现在项目需要实现根据关键词搜索实现扫描件的文本匹配,简单来说就是es 全文检索增加调用ocr接口的操作实现扫描件也能被搜索到的效果。

步骤

离线安装ik插件

IK 分词器的作用
IK 分词器是 Elasticsearch 在 倒排索引阶段使用的工具,它会将每个 text 字段里的内容进行中文词语的切分(不是切片!),例如:

原文:中华人民共和国国歌

IK 分词结果(ik_max_word):
["中华", "中华人民", "中华人民共和国", "人民", "共和国", "国歌"]
IK 是为了构建有效的关键词索引,让你搜索“共和国”时能命中整个段落内容。

下载插件:
ik插件git地址

  1. 查找和自己es对应的插件版本,进行下载对应的zip
  2. es安装目录下的plugin下,mkdir 创建一个文件夹 ik ,将zip放过去,然后进行解压
  3. 然后然后重启es
  4. 执行相关接口创建files索引


1、请求配置
方法: PUT

URL: http://localhost:9200/files

(确保你本地的 Elasticsearch 是运行在 9200 端口,如果不是请改成对应端口)

2. 设置 Headers
Key	Value
Content-Type	application/json
{

  "mappings": {
    "properties": {
      "filename": { "type": "keyword" },
      "text": {
        "type": "text",
        "analyzer": "ik_max_word",
        "search_analyzer": "ik_smart"
      },
      "type":{
       "type": "keyword"
      } 
      
    }
  }

响应

{
  "acknowledged": true,
  "shards_acknowledged": true,
  "index": "files"
}

硬编码编写

// 项目结构: com.example.elasticsearchsearch
// ├── Application.java
// ├── config/ElasticsearchConfig.java
// ├── controller/FileUploadController.java
// ├── controller/SearchController.java
// ├── service/FileParserService.java
// ├── service/ElasticService.java
// ├── resources/application.yml
// ├── pom.xml

// ========== Application.java ==========
package com.example.elasticsearchsearch;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

// ========== config/ElasticsearchConfig.java ==========
package com.example.elasticsearchsearch.config;

import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.client.RestClientBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ElasticsearchConfig {
    @Bean
    public RestHighLevelClient client() {
        RestClientBuilder builder = RestClient.builder(
            new org.apache.http.HttpHost("localhost", 9200, "http")
        );
        return new RestHighLevelClient(builder);
    }
}

// ========== controller/FileUploadController.java ==========
package com.example.elasticsearchsearch.controller;

import com.example.elasticsearchsearch.service.FileParserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.core.io.UrlResource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;

@RestController
@RequestMapping("/files")
public class FileUploadController {

    @Autowired
    private FileParserService fileParserService;

    @PostMapping("/upload")
    public ResponseEntity<String> upload(@RequestParam("file") MultipartFile file) {
        try {
            fileParserService.saveFileToDisk(file);
            String content = fileParserService.parseFileWithFallback(file);
            fileParserService.indexFile(file.getOriginalFilename(), content);
            return ResponseEntity.ok("上传并索引成功");
        } catch (Exception e) {
            return ResponseEntity.status(500).body("上传失败: " + e.getMessage());
        }
    }

    @GetMapping("/download/{filename}")
    public ResponseEntity<?> download(@PathVariable String filename) throws IOException {
        Path path = Paths.get("upload-dir/original/" + filename);
        Resource resource = new UrlResource(path.toUri());
        return ResponseEntity.ok()
                .header("Content-Disposition", "attachment; filename=\"" + filename + "\"")
                .body(resource);
    }

    @GetMapping("/ocr-preview/{filename}")
    public ResponseEntity<?> downloadOcrWord(@PathVariable String filename) throws IOException {
        Path path = Paths.get("upload-dir/ocr-word/" + filename + ".docx");
        Resource resource = new UrlResource(path.toUri());
        return ResponseEntity.ok()
                .header("Content-Disposition", "inline; filename=\"" + filename + ".docx\"")
                .body(resource);
    }
}

// ========== controller/SearchController.java ==========
package com.example.elasticsearchsearch.controller;

import com.example.elasticsearchsearch.service.ElasticService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/search")
public class SearchController {

    @Autowired
    private ElasticService elasticService;

    @GetMapping
    public List<Map<String, Object>> search(@RequestParam String keyword) throws IOException {
        return elasticService.search(keyword);
    }
}

// ========== service/FileParserService.java ==========
package com.example.elasticsearchsearch.service;

import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.tika.Tika;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;

import java.io.*;
import java.nio.file.*;
import java.util.*;

@Service
public class FileParserService {

    @Autowired
    private ElasticService elasticService;

    public String parseFileWithFallback(MultipartFile file) throws Exception {
        Tika tika = new Tika();
        try {
            return tika.parseToString(file.getInputStream());
        } catch (Exception e) {
            String textFromOcr = callOcrApi(file);
            saveAsWord(file.getOriginalFilename(), textFromOcr);
            return textFromOcr;
        }
    }

    public String callOcrApi(MultipartFile file) throws IOException {
        RestTemplate restTemplate = new RestTemplate();
        return restTemplate.postForObject("http://your-ocr-service/ocr", file.getBytes(), String.class);
    }

    public void saveAsWord(String originalFilename, String content) throws IOException {
        Path wordPath = Paths.get("upload-dir/ocr-word/" + originalFilename + ".docx");
        Files.createDirectories(wordPath.getParent());
        try (XWPFDocument doc = new XWPFDocument();
             FileOutputStream out = new FileOutputStream(wordPath.toFile())) {
            XWPFParagraph paragraph = doc.createParagraph();
            paragraph.createRun().setText(content);
            doc.write(out);
        }
    }

    public void saveFileToDisk(MultipartFile file) throws IOException {
        Path path = Paths.get("upload-dir/original/" + file.getOriginalFilename());
        Files.createDirectories(path.getParent());
        Files.copy(file.getInputStream(), path, StandardCopyOption.REPLACE_EXISTING);
    }

    public void indexFile(String filename, String content) throws IOException {
        Map<String, Object> doc = new HashMap<>();
        doc.put("filename", filename);
        doc.put("text", content);
        doc.put("type", filename.endsWith(".docx") ? "ocr" : "original");
        elasticService.indexDocument(doc);
    }
}

// ========== service/ElasticService.java ==========
package com.example.elasticsearchsearch.service;

import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.query.MatchQueryBuilder;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;
import org.elasticsearch.search.fetch.subphase.highlight.HighlightField;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.util.*;

@Service
public class ElasticService {

    @Autowired
    private RestHighLevelClient client;

    public void indexDocument(Map<String, Object> doc) throws IOException {
        IndexRequest request = new IndexRequest("files");
        request.source(doc, XContentType.JSON);
        client.index(request, RequestOptions.DEFAULT);
    }

    public List<Map<String, Object>> search(String keyword) throws IOException {
        SearchRequest request = new SearchRequest("files");
        SearchSourceBuilder builder = new SearchSourceBuilder();
        MatchQueryBuilder match = new MatchQueryBuilder("text", keyword);

        HighlightBuilder highlight = new HighlightBuilder()
                .field("text")
                .preTags("<span style='color:red'>")
                .postTags("</span>");

        builder.query(match).highlighter(highlight);
        request.source(builder);

        SearchResponse response = client.search(request, RequestOptions.DEFAULT);

        List<Map<String, Object>> results = new ArrayList<>();
        for (SearchHit hit : response.getHits()) {
            Map<String, Object> source = hit.getSourceAsMap();
            Map<String, HighlightField> hl = hit.getHighlightFields();
            if (hl.containsKey("text")) {
                source.put("highlight", hl.get("text").fragments()[0].string());
            }
            source.put("download_url", "/files/download/" + source.get("filename"));
            if ("ocr".equals(source.get("type"))) {
                source.put("ocr_preview_url", "/files/ocr-preview/" + source.get("filename"));
            }
            results.add(source);
        }
        return results;
    }
}

// ========== resources/application.yml ==========
spring:
  servlet:
    multipart:
      max-file-size: 100MB
      max-request-size: 100MB

# ========== pom.xml ==========
<!-- 请将下列依赖加入到你的 pom.xml 中 -->
<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">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example</groupId>
    <artifactId>elasticsearch-search</artifactId>
    <version>1.0.0</version>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
            <version>7.9.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tika</groupId>
            <artifactId>tika-core</artifactId>
            <version>2.9.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tika</groupId>
            <artifactId>tika-parsers-standard-package</artifactId>
            <version>2.9.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>5.2.3</version>
        </dependency>
    </dependencies>
</project>

小问题:

上述硬编码可能需要根据用户需求进行具体调试,比如编码格式
在这里插入图片描述

比如es设置了账号密码

@Configuration
public class ElasticsearchConfig {

    @Value("${elasticsearch.host:localhost}")
    private String host;

    @Value("${elasticsearch.port:9200}")
    private int port;

    @Value("${elasticsearch.username}")
    private String username;

    @Value("${elasticsearch.password}")
    private String password;

    @Bean
    public RestHighLevelClient client() {
        final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
        credentialsProvider.setCredentials(AuthScope.ANY,
                new UsernamePasswordCredentials(username, password));

        RestClientBuilder builder = RestClient.builder(new HttpHost(host, port, "http"))
                .setHttpClientConfigCallback(httpClientBuilder -> 
                    httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider)
                );

        return new RestHighLevelClient(builder);
    }
}

最终效果:

在这里插入图片描述

总结

最终展示到前端的是搜索框以及搜索出来的段落及高亮还有原版文档,这样就解决了扫描件无法被识别的问题,算是曲线救国啦~
深究背后原理倒排索引,下篇博客见啦~

参考文档如下:

安装单机es
还有chatgpt

注意点:

上传文档分片的时候报409 too many requests

去看es日志 发现es数据磁盘满了 所以会导致无法处理
解决方式:
换es的数据目录,改配置文件后重启

会报密码问题

这时候解决方式:

✅ 一、前提确认

假设你用的是标准安装版(systemctl 管理的 ES),路径如下:

配置文件:/etc/elasticsearch/elasticsearch.yml

数据目录:/data/elasticsearch(你改过)

安装目录:/usr/share/elasticsearch

服务名:elasticsearch

如果路径不同也没关系,我会标明每个步骤的可替代写法。

🧩 二、清空旧数据(从头开始)

我们不保留旧的索引或认证数据。

sudo systemctl stop elasticsearch
sudo rm -rf /data/elasticsearch/*
sudo mkdir -p /data/elasticsearch
sudo chown -R elasticsearch:elasticsearch /data/elasticsearch
sudo chmod -R 750 /data/elasticsearch

⚙️ 三、修改配置文件

编辑 /etc/elasticsearch/elasticsearch.yml,确保包含以下内容(可以复制追加到文件末尾):

path.data: /data/elasticsearch
path.logs: /data/elasticsearch/logs

cluster.name: es-cluster
node.name: node-1

network.host: 0.0.0.0
http.port: 9200

discovery.type: single-node

xpack.security.enabled: true


保存退出。

🚀 四、启动 Elasticsearch
sudo systemctl start elasticsearch


等待 30 秒左右(首次初始化较慢)。

🔐 五、初始化账户密码

执行:

sudo /usr/share/elasticsearch/bin/elasticsearch-setup-passwords interactive


如果系统提示:

Initiating the setup of passwords for reserved users.
You will be prompted to enter passwords as the process progresses.


✅ 表示集群是全新状态,可以设置密码。

当提示设置 elastic 用户时,输入:

elastic password: ****
Ansys Circuit新手必看:IBIS模型导入时,Pin Import和Buffer Import到底怎么选? 本文详细解析了Ansys Circuit中IBIS模型导入时Pin Import与Buffer Import的选择策略,帮助SI/PI工程师根据仿真需求做出正确决策。通过对比两种方式的特性差异和应用场景,提供实用的选择指南和性能优化建议,提升信号完整性仿真效率。 阅读详情

相关推荐

STM32F407ZGT6最小系统:从原理图到PCB的实战设计与避坑指南

本文详细介绍了STM32F407ZGT6最小系统的设计与实现,从原理图到PCB布局的完整流程。重点解析了电源、时钟、复位和调试接口等核心模块的设计要点,提供了实用的PCB布局技巧和常见问题解决方案,帮助开发者避开设计陷阱,快速完成稳定可靠的STM32F407ZGT6最小系统设计。

weixin_30955617的博客 201

全文检索 Elasticsearch(简称es)

全文检索 Elasticsearch 研究 1. ElasticSearch 介绍 1.1 介绍 **Elasticsearch**是一个基于Lucene库的搜索引擎。它提供了一个分布式、支持多租户的全文搜索引擎,具有HTTP Web接口和无模式JSON文档。Elasticsearch是用Java开发的,并在Apache许可证下作为开源软件发布。官方客户端在Java、.NET(C#)、PHP、Py...

CORN的博客 2万+

蛋白组学/磷酸化蛋白组学分析笔记-2

如何校正蛋白丰度?磷酸化组学质谱下机处理。

weixin_43029125的博客 1381

es--基础--6.1--springboot--集成elasticsearch

【代码】es--基础--6.1--springboot--集成elasticsearch。

zhou920786312的博客 2993

Error: dependent ‘..\..\..\..\Qt\5.15.2\msvc2019\include\QtWidgets\QMainWindow‘ does not exist.

核心问题:修改 Build 目录为源码子目录后,MSVC 编译报错,本质是变量设置异常,导致 qmake 生成多余回溯路径;临时解决:在 .pro 文件添加;最优解决:将上述配置写入 Qt 的 msvc 对应 qmake.conf 全局文件,一劳永逸;禁止 qmake 计算路径时向上回溯,避免生成异常路径。

mumufan05的专栏 892

从零到千兆:KSZ9031 PHY芯片在Zynq PS端的驱动移植心路历程

本文详细记录了在Xilinx Zynq-7000平台(基于XC7Z020芯片)上,为KSZ9031千兆以太网PHY芯片移植LwIP协议栈驱动的完整过程。从硬件连接配置、Vivado工程设置到LwIP库的深度修改与调试,分享了解决PHY识别、自协商及性能优化等关键问题的实战经验,助力开发者实现稳定的千兆网络连接。

honey的博客 1121

ES高亮显示语法

掌握es高亮显示语法,包括自定义高亮标签属性、多字段高亮显示。

前者已逝,后者未至。 4737

【异常】飞书OpenClaw机器人 HTTP 401: Invalid Authentication 报错排查与解决方案

HTTP 401 是HTTP协议标准定义的未授权(Unauthorized)状态码,核心含义为请求方身份认证无效,服务端拒绝执行本次请求。飞书开放平台服务端对自建机器人的全链路鉴权校验失败。无论是机器人接收飞书事件推送的上行请求,还是机器人主动调用飞书开放平台API的下行请求,只要身份凭证无效、鉴权逻辑校验不通过,飞书服务端就会返回该报错,并最终透传到飞书客户端会话窗口中。

奶爸的编程之路,也就一周冷个三天 3777

ElasticSearch(ik分词器)+SpringBoot站内全文搜索解决方案

目录摘要1 技术选型1.1 ElasticSearch1.2 springBoot1.3 ik分词器2 环境准备3 项目架构4 实现效果4.1 搜索页面4.2 搜索结果页面5 具体代码实现...

独行侠梦的博客 3528

c#上位机最强教程之环境安装

本文介绍了.NET 6开发环境的安装配置指南。主要内容包括:1)安装.NET 6 SDK和Runtime的方法及验证步骤;2)Visual Studio 2022的安装流程;3)创建第一个.NET 6控制台项目;4)项目结构解析和配置文件说明。文章还提供了实践练习和常见问题解答,帮助初学者快速搭建开发环境并运行简单程序。适用于零基础开发者,学习时间约10分钟。

飞上云层 321

codex出现Reconnecting和stream disconnected before completion:stream closed before response.complete解决方案

本文主要介绍了在使用codex过程中出现Reconnecting和stream disconnected before completion: stream closed before response.completed的解决方案,希望能对使用codex的同学们有所帮助。 文章目录 1. 问题描述 2. 解决方案

weixin_43178406的博客 10万+

ElasticSearch是什么?Lucene是什么?

ElasticSearch 分布式全文检索引擎 Elasticsearch是一个基于Lucene的搜索服务器。它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口(请求分类 get post delete put)。Elasticsearch是用Java语言开发的,并作为Apache许可条款下的开放源码发布,是一种流行的企业级搜索引擎。Elasticsearch用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便。官方客户端在Java、.NET(C#)、PHP、Python

jj89929665的博客 1003

14、脑肿瘤复发预测与转移瘤跟踪的自动化方法

本文介绍两种脑肿瘤相关自动化方法:一种用于预测胶质瘤切除术后的肿瘤复发位置,结合图像配准、静态模型和动态模拟模型,利用患者的DTI数据进行预测;另一种用于在纵向扫描中跟踪转移性脑肿瘤,通过联合求解配准参数估计和图像变化标记问题,提高肿瘤跟踪的准确性和效率。文章同时分析了两种方法的优势与挑战,并提出了未来研究方向,旨在为脑肿瘤的诊断和治疗提供更可靠的工具。

defi6farmer的博客 127

基于django+elasticsearch的全文检索

基于django+elasticsearch的全文检索 ​ 关于django和elasticsearch,就不做过多的介绍了(内容太多啦,哈哈哈哈)。直接进入正题。 一、django+haystack+elasticsearch ​ 了解过django+elasticsearch全文检索的,可能还听说过python另外一个搜索框架:haystack,这是python里面自带的一个搜索引擎,通常情况...

JAY_jzj的博客 4806

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

vb 6.0并口开发操作实例

vb6并口开发,简体中文,试例内有inpout32.dll动态链接库

ElasticSearch7 实现全文检索、关键词高亮

本篇概要:1. 全文检索概念;2. 全文检索引擎 ElasticSearch;3. 安装 ElasticSearch 以及中文分词插件 IK;3.1 安装 ElasticSearch7;3.2 安装 elasticsearch-head;3.3 ElasticSearch 设置密码;3.4 安装中文分词插件 IK;4. 创建索引;5. 全文数据检索以及关键字高亮显示; 1. 全文检索概念; 相关...

业余敲代码 7077

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

Elasticsearch全文检索指南:字段匹配高亮显示技术详解

在全文检索系统中,高亮显示(Highlighting)是一项基础但极其重要的功能。当用户执行搜索查询时,系统不仅需要返回匹配的文档,还需要直观地展示文档中哪些部分与查询条件匹配。Elasticsearch作为领先的搜索引擎,提供了强大的高亮显示功能,可以帮助开发者快速实现这一需求。 ## 基础高亮实现 让我们从一个简单的示例开始,了解Elasticsearch中高亮显示的基本用法。 首先,我...

gitblog_00063的博客 565

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

ES实现全文检索+高亮显示

本次实现ES检索以TP6为例 框架操作ES首先需要安装ES类: composer require elasticsearch/elasticsearchg 高亮显示需要安装collision类: composer require nunomaduro/collision 本次数据展示和检索使用vue实现 添加数据的表单 <div class="container"> <form action="save" method="post"> <div cl

张俊勇的博客 1880

Elasticsearch简介及SpringBoot整合ES实例

Elasticsearch简介 1.1 Elasticsearch(以下简称ES)定义 Elasticsearch 是一个开源的搜索引擎。 建立在全文搜索引擎库 Apache Lucene 基础之上。它的内部使用 Lucene 做索引与搜索,但是它的目的是使全文检索变得简单,通过隐藏 Lucene 的复杂性,取而代之的提供一套简单一致的 RESTful API。 Elasticsearch ...

weixin_42184707的博客 8861

科普文:Elasticsearch系列之【Elasticsearch实操:全文搜索与高亮显示】

,"mate70, 非凡大师"},"name": {},通过同义词分析器,用户搜索“ huawei mate”时也可以匹配到包含“mate”的文档,从而进一步提升搜索的准确性。小结一下通过上述步骤,我们可以实现一个完整的 Elasticsearch 全文搜索与高亮显示的功能。这个功能适用于电商平台、博客搜索、文档系统等多种业务场景,提供快速、高效、用户友好的搜索体验。

为无为,事无事,味无味。 1254

SpringBoot+ElasticSearch实现文档内容抽取、高亮分词、全文检索

es

weixin_54951878的博客 1821

【搜索引擎:Elasticsearch】从0了解ES,整合springboot,京东搜索实战

📣 📣 📣 📢📢📢 ☀️☀️你好啊!小伙伴,我是小冷。是一个兴趣驱动自学练习两年半的的Java工程师。 📒 一位十分喜欢将知识分享出来的Java博主⭐️⭐️⭐️,擅长使用Java技术开发web项目和工具 📒 文章内容丰富:覆盖大部分java必学技术栈,前端,计算机基础,容器等方面的文章 📒 如果你也对Java感兴趣,关注小冷吧,一起探索Java技术的生态与进步,一起讨论Java技术的使用与学习 ✏️高质量技术专栏专栏链接: 微服务,数据结构,netty,单点登录,SSM ,SpringCloudAli.

doomwatcher的博客 2291

Springboot集成Elasticsearch实现全文检索三【springboot集成Elasticsearch实现检索】

一、POM依赖: <dependency> <groupId>org.elasticsearch.client</groupId> <artifactId>elasticsearch-rest-high-level-client</artifactId> <version>7.4.0</version> &lt

佛系逍遥 998

Es全文检索

es、ik、kibana、springboot、全文检索功能

qq_38123445的博客 1092

ElasticSearch (ES)学习之路(一)ES 概念

ElasticSearch (ES)学习之路(一) 最近在自主学习全文检索技术中… 为什么咱们的数据库有了查询查询功能还要额外使用其余的搜索技术? 为什么要用搜索引擎?我们的所有数据在数据库里面都有,而且 Oracle、Mysql等数据库里也能提供查询检索或者聚类分析功能,直接通过数据库查询不就可以了吗?确实,我们大部分的查询功能都可以通过数据库查询获得,如果查询效率低下,还可以通过建数据库索引,优化SQL等方式进行提升效率,甚至通过引入缓存来加快数据的返回速度。如果数据量更大,就可以分库分表来分担查询压力

胖虎儿的博客 6841

全文检索-ElasticSearch入门

1. 基于Lucene的全文检索 1.1 全文检索概念     将非结构化数据中的一部分信息提取出来,重新组织,使其变得有一定结构,然后对此有一定结构的数据进行检索,从而达到搜索相对较快的目的。从非结构化数据中提取出来并重新组织的信息,我们称之为索引。 例如:字典中的拼音表、偏旁部首表就相当于字典的索引。     这种先建立索引,再对索引进行搜索的过程就叫全文检索(Full-text Search)。 注意:索引创建过程十分耗时,但是一旦创建有利于复用。全文检索主要处理的是查询,所以虽然创建索引耗时,

lijinghua的博客 2908

使用Django-haystack实现全文检索及Elasticsearch引擎

django是python语言的一个web框架,功能强大。配合一些插件可为web网站很方便地添加搜索功能。 搜索引擎使用whoosh,是一个纯python实现的全文搜索引擎,小巧简单。 中文搜索需要进行中文分词,使用jieba。 直接在django项目中使用whoosh需要关注一些基础细节问题,而通过haystack这一搜索框架,可以方便地在django中直接添加搜索功能,无需关注索引建立、...

菲宇运维 4181
上一篇: dify离线插件打包步骤
下一篇: 重新打包镜像
balance…
balance… 新星创作者: Java技术领域 新星创作者: Java技术领域 领域专家: 后端开发技术领域 领域专家: 后端开发技术领域
博客等级 码龄7年 1万+粉丝 181原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

balance…

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值