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

為{幸葍}努か 提交于 2019-12-11 17:18:58

问题


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


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/43802467/has-lucene-search-engine-not-solr-rest-api-for-querying-the-indexed-content

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!