NeatNerd
NeatNerd

Reputation: 2373

Limit number of characters in the stored field

I have a document with 195 million characters. It gets indexed ok, but when it comes to displaying it to the user, I dont need to display it fully, just lets say 1 million characters or so, not to mention that Solr crashes as well.

Is it possible to limit number of characters stored/displayed, but index all. Like in copy field:

<copyField source="cat" dest="text" maxChars="30000" />

Upvotes: 0

Views: 123

Answers (1)

Alexandre Rafalovitch
Alexandre Rafalovitch

Reputation: 9789

You are nearly providing your own answer.

  1. Use copyField with maxChars settings
  2. Have the original field as stored=false, indexed=true
  3. Have the copied field as stored=true, indexed=false
  4. Search the original field, but return copied field

However, you may consider not having that content in Solr at all, but have it outside of Solr. At least if you have multiple documents like that in Solr.

Upvotes: 1

Related Questions