Skip to content

Anusha3002/LuceneSearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LuceneSearch

A Search Engine based on Lucene. Apache Lucene is a free and open-source search engine software library, originally written in Java. Lucene is widely used as a standard foundation for production search applications

This Project uses:

  1. Oracle JDK 17
  2. Lucene 9.8.1
  3. Installation
  4. Springboot
  5. Planning to add vector db (Pinecone)
  • Semantic Search

The easiest way to use Lucene in your project is to import it using Maven. You need to at least import lucene-core (just pasting the following to your pom.xml's dependencies).

org.apache.lucene lucene-core 8.10.1

You may also need Lucene-analyzers-common and lucene-queryparser.

org.apache.lucene lucene-analyzers-common 9.8.1 org.apache.lucene lucene-queryparser 8.10.1

Searching documents: BuildQuery

Query Parsing logic

https://lucene.apache.org/core/2_9_4/queryparsersyntax.html#Overview

Available Type of query in lucene

  • BooleanQuery
  • ConstantScoreQuery
  • CustomScoreQuery
  • DisjunctionMaxQuery
  • FilteredQuery
  • MatchAllDocsQuery
  • MultiPhraseQuery
  • MultiTermQuery
  • PhraseQuery
  • RangeQuery
  • SpanQuery
  • TermQuery
  • ValueSourceQuery

BooleanQuery is most important and it follows, AND, OR, MUST, MUST_NOT and SHOULD

BooleanQuery can be created using other other type of query and BooleanQuery itself

You can view this in details here

https://riptutorial.com/lucene/example/19933/booleanquery

Example Boolean Query

String str = "foo bar";
String id = "123456";
BooleanQuery bq = new BooleanQuery();
Query query = qp.parse(str);
bq.add(query, BooleanClause.Occur.MUST);
bq.add(new TermQuery(new Term("id", id), BooleanClause.Occur.MUST_NOT);

Using spring-boot, java 17, maven, react

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published