Giter VIP home page Giter VIP logo

lucene's Introduction

lucene

基于lucene与IKAnalyzer的中文搜索demo及学习记录

Lucene是apache下的一个开放源代码的全文检索引擎工具包。提供了完整的查询引擎和索引引擎,部分文本分析引擎。 Lucene的目的是为软件开发人员提供一个简单易用的工具包,以方便的在目标系统中实现全文检索的功能。

IKAnalyzer 是一个开源的,基于java语言开发的轻量级的中文分词工具包最初,它是以开源项目 Lucene为应用主体的,结合词典分词和文法分析 算法的中文分词组件。新版本的IKAnalyzer3.0则发展为 面向Java的公用分词组件,独立于Lucene项目,同时提供了对Lucene的默认优化实现。

开发环境及项目框架介绍

学习记录

数据准备

介绍以下俩种初始数据的方式:

  • 1、通过数据库代码baike.sql中 的数据作为初始数据
  • 2、通过Python爬取百度百科的词条数据作为本搜索的基础数据,爬取介绍及操作方式见PythonSpider

项目运行

    @GetMapping("/index")
    public String createIndex(int limit,int offset) {
        // 拉取数据
        List<Baike> baikes = baikeMapper.getAllBaike(limit,offset);
        seargitchService.write(baikes);
        return "成功";
    }
    //搜索,实现高亮
    @GetMapping("search/{q}")
    public List<Map> getSearchText(@PathVariable String q) throws Exception {
        List<Map> mapList = searchDataBase.search("summary", q);
        return mapList;
    }

运行效果

search

lucene's People

Contributors

suxiongwei avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.