0

I had developed a lucene search engine (with Lucene 5.2.1) and now I want to embed it into a very simple web application (it has demonstrative purpose, it will run in localhost).

This web application should let the user insert some keywords and navigate through search results (in other words it should let the user read the index that I had created, with appropriate html formatting). I had already made some simple html GUI with Bootstrap.

I'm very new to web applications, but I had been told that a good idea would be embedding Lucene in a TomCat server. I had visited this link, but it's quite old and not very detailed. I have tried to look for "lucene tomcat" but I get results about SolR or very specific posts.

Can anyone please suggest me a good resource or a general approach to my issue? Many thanks

mazerone
  • 111
  • 1
  • 9
  • You need to create a servlet (war file). This is independent of Lucene itself, which is simply an API that your program calls. Google "java create servlet" and start from there. Once you have the hello world working, it should be trivial to call Lucene from there. – Fermin Silva Aug 06 '15 at 15:17
  • Thank you, I am trying to create a Servlet on TomCat with Eclipse. It all seems quite simple, but I often get mysterious errors like: "server failed to start". But I have found many Q&A [on this topc](http://stackoverflow.com/questions/13244233/server-tomcat-v7-0-server-at-localhost-failed-to-start) – mazerone Aug 07 '15 at 15:03

1 Answers1

0

My solution:

  1. I wrapped my search engine library into a JAR file.
  2. I downloaded zipped version of TomCat 8 and installed it into my Eclipse environment as a new Runtime Enviroment.
  3. I made a Dynamic Web Project in Eclipse (see this video lesson) using TomCat 8 server.
  4. I put the JAR into my webapp (should be something like WebContent\WEB-INF\lib\searchEngine.jar)
  5. I created a Servlet to handle user input.
  6. I did the rest using very simple JSP pages, embedding Java code that uses my JAR (I know, that is not so good but it works!)

Cheers!

Unihedron
  • 10,902
  • 13
  • 62
  • 72
mazerone
  • 111
  • 1
  • 9