简体   繁体   中英

Has lucene search engine (Not Solr) REST API for querying the indexed content?

How to query the indexed content in Lucene. Do we need to write any script or any api's available to query the index.

No, Lucene is a library; you have to write custom java code to do anything useful with it.

If you are looking for something higher level, that does not require you to write code, look for Solr or elasticsearch both of which are built on top of Lucene.

How to query the indexed content in Lucene? You write a Java class using ÌndexReader and ÌndexSearcher classes of Lucene API. You need to build a query and pass on to searcher instance as parameter. There is no automatic REST point.

Lucene is simply an API, originally in Java then later ported to .NET too so either you can use Java or C# to develop your index creator as well as index searcher programs.

Your searcher code will eventually be a Java Class and it is you - the programmer who might wish to expose search logic via a REST End Point. Lucene doesn't provide any off the shelf things like that.

IndexReader and IndexSearcher are main Java classes for searching an index.

Lucene API changes heavily from one version to another so look for code examples for only your chosen version.

As per accepted answer of this SO Question , its possible to search a lucene index with SOLR. I have personally not performed that kind of search though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM