Java source files of the solr index as text

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!

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.