Solr – Clean up Index


Sometimes you want to delete all the records from the Solr index without deleting the index directory.
This can be done by executing an http url :-



Or by posting data xml data :-

Cleaning data using Solrj :-

Solr Sort feature

User usually like to Solr of Fields such as Document title and do not get the expected results.

Few key things to take into account when using fields for Sorting in Solr –

  • Sorting doesn’t work good on multivalued and tokenized fields. (multivalued=”false”)
  • The field should be marked as indexed to enable sorting. (indexed=”true”)

Documentation – 
Sorting can be done on the “score” of the document, or on any multiValued=”false” indexed=”true” field provided that field is either non-tokenized (ie: has no Analyzer) or uses an Analyzer that only produces a single Term (ie: uses the KeywordTokenizer)

Chaining Solr copyField

Solr does not allow chaining of copyfields and it does not recurse.


e.g.

Solr Documentation @ http://wiki.apache.org/solr/SchemaXml#Copy_Fields quotes

The copy is done at the stream source level and no copy feeds into another copy.


So a copyfield cannot be a source of other copyfield tag.
The copyfield source must be an actual field, which has some value and does no cascade.