Home > Back-end >  Full text search summary
Full text search summary

Time:09-27

A full text search theory
1.1 why need full text search to solve the problem of data query
1 huge amounts of data like low efficiency of query (fuzzy query)
Search the Java 2 query result is bad, will put the javascript this irrelevant also found out
3 no relevance ranking
4 did not highlight
5 not intercept the

1.2 what is the full text retrieval
Generalized: the structured data index creation first, and then from the index retrieval search,
Special: the search for text data

1.3 advantages
1 huge amounts of data query efficiency - query based on index
2 good query effect according to the word search
3 have relevance ranking
4 have highlighted
5 have the intercept

1.4 full text search solution
1 Java toolkit lucene, small to medium sized projects
Full text search server 2 (es, sorl, etc.) - a large project, small projects can also

1.5 full text search core
Create indexes: participle - syntax analysis - sort - to heavy operations such as
Search index: participle - search - search conditions to deal with the results

Introduction to two
2.1 create a project and import the jar

Org. Apache. Lucene
Lucene - core
5.5.0 & lt;/version>


Org. Apache. Lucene
Lucene - analyzers - common
5.5.0 & lt;/version>


Org. Apache. Lucene
Lucene - queryparser
5.5.0 & lt;/version>

2.2 create an index
1) obtain IndexWriter
2) create a document object
3) add document to Indexwriter and submit
4) Luke GUI client test
2.3 the search index
1) input keywords
2) encapsulated by keywords Query object
3) create an IndexSearcher
4) the search Query to search - hit the document number, document ids
5) get the document by document id
6) convert the document to want the object ok

Three API,
1 the FsDirectory. Open the bottom platform compatible
2 TextField (participle) & amp; StringFeild (words)
3 ik participle
1 in the lib way import v5jar
2 simple test - with English
3 stop words & amp; Extensions word
4 participle granularity true: maximum size false fine-grained
4 TearmQuery& BooleanQUery
  • Related