toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  var fieldVectors = this.fieldVectors.keys.toList().map((ref) {
    return [ref.toString(), this.fieldVectors[ref]!.toJson()];
  }).toList();

  var invertedIndex = (this.invertedIndex.keys.toList()
        ..sort((a, b) => '$a'.compareTo('$b')))
      .map<List>((e) => [e.toString(), this.invertedIndex[e]!.toJson()])
      .toList();

  var pipeline = this.pipeline.toJSON();

  return {
    'version': Lunr.version,
    'fields': fields,
    'fieldVectors': fieldVectors,
    'invertedIndex': invertedIndex,
    'pipeline': pipeline
  };
}