2

I want to upload lots of source files (say, java) to solr to allow indexed search on them. They should be posted as plain text files.

No special parsing is required. When trying to upload one java file I get "Unknown Source" related error.

java.lang.NoClassDefFoundError: com/uwyn/jhighlight/renderer/XhtmlRendererFactory

When I rename the file adding .txt in the end, it is uploaded successfully.

I have thousands of files to upload on a daily basis and need to keep original names. How do I tell solr to treat all files in the directory as .txt? Advanced thanks!

2 Answers 2

3

For googlers, concerning the Solr error:

java.lang.NoClassDefFoundError: com/uwyn/jhighlight/renderer/XhtmlRendererFactory

You can correct this by adding the jar "jhighlight-1.0.jar" in Solr. To do so:

  • Download the old solr 4.9. In recent version, jhighlight is not present.

  • Extract solr-4.9.0\contrib\extraction\lib\jhighlight-1.0.jar

  • Copy jhighlight-1.0.jar to the solr installation under solr/server/lib/ext/

  • Restart the server.

Sign up to request clarification or add additional context in comments.

1 Comment

This helped. Downloaded the jar from maven - mvnrepository.com/artifact/com.uwyn/jhighlight/1.0
0

You can achieve the same by integrating solr with tika.

Apache will help you to extract the text of the source files.

It has a source code parser which supports c,c++ and Java.

Here is the link which will give you more details. https://googleweblight.com/?lite_url=https://tika.apache.org/1.12/formats.html&lc=en-IN&s=1&m=972&host=www.google.co.in&ts=1461564865&sig=APY536wBFFAcFH7yUyvhh2TFslPz6LeClA

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.