Skip to content

Instantly share code, notes, and snippets.

@danse
Last active August 29, 2015 14:10
Show Gist options
  • Save danse/62e5f82dc35f673da349 to your computer and use it in GitHub Desktop.
Save danse/62e5f82dc35f673da349 to your computer and use it in GitHub Desktop.
Naming convention for Lucene fields

Naming convention for Lucene fields

This page describes how to convert from a JSON path in a document to a flat field name for Lucene indexing

Convention

Just replace the dot . with an underscore _. Convert cases to lowercase. Convert underscore separated to no separation.

Examples
doc.name -> name
doc.patient.name -> patient_name
doc.patient.referenceNo -> patient_referenceno
doc.patient.reference_no -> patient_referenceno // you should not have underscore separated in Javascript anyway
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment