Is there a way, via configuration, to use spring-data-solr with Tika? Otherwise, is there some alternative to solrj’s ContentStreamUpdateRequest+addfile for spring-data-solr?
Currently I am using Solrj + Tika in this manner:
SolrServer server = new HttpSolrServer(URL);
...
Tika tika = new Tika();
...
String fileType = tika.detect(path.toFile());
up = new ContentStreamUpdateRequest("/update/extract");
up.addFile(path.toFile(), fileType);
up.setParam("literal.id", idField);
...
up.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);
NamedList<Object> request = server.request(up);
I arrived at this method by successfully following this ExtractingRequestHandler guide.
Using solr 4.3.0, is is possible get the same result via spring-data-solr, instead of having to invoke Solrj directly?
There is no direct support for
ContentStreamUpdateRequest. The fallback would be to do it within aSolrCallbackexecuted bySolrTemplate.In case you need this kind of behavior in more repositories then probably this post about adding custom methods to all repositories might help.