pinpox
pinpox

Reputation: 179

Solrj index string containing html in java

I know how to index a html page I downloaded using:

ContentStreamUpdateRequest up = new ContentStreamUpdateRequest("/update/extract");

    up.addFile(new File(fileName), solrId);
    up.setParam("literal.id", solrId);
    up.setAction(ACTION.COMMIT, true, true);
    getServer().request(up);

If I have the html page in a string String mystring how can I index it without having to save it to a file and read it again?

Upvotes: 0

Views: 138

Answers (1)

MatsLindh
MatsLindh

Reputation: 52852

Instead of using the addFile method, use addContentStream with a ContentStreamBase.StringStream. This will make the CeontentStreamUpdateRequest pull its data from a String instead of a file.

Related documentation:

Upvotes: 1

Related Questions