Exemple #1
0
        public virtual void AddRecord(Record record)
        {
            if (Records == null)
                Records = new List<Record>();

            Records.Add(record);
        }
 private void AddToIndex(Record record, string patientCPF, IndexWriter indexWriter)
 {
     RemoveIndex(record, patientCPF, indexWriter);
     var doc = new Document();
     AddFields(record, doc, patientCPF);
     indexWriter.AddDocument(doc);
 }
        private Record _mapLuceneDocumentToData(Document doc)
        {
            var record = new Record()
            {
                Code = doc.Get("Code"),
                Hospital = new Hospital { Key = doc.Get("Hospital") },
            };

            return record;
        }
 private void AddFields(Record record, Document doc, string patientCPF)
 {
     doc.Add(new Field("PatientCPF", patientCPF, Field.Store.YES, Field.Index.ANALYZED));
     doc.Add(new Field("Code", record.Code, Field.Store.YES, Field.Index.ANALYZED));
     doc.Add(new Field("Hospital", record.Hospital.Key, Field.Store.YES, Field.Index.ANALYZED));
 }
        private void RemoveIndex(Record record, string patientCPF, IndexWriter writer)
        {
            var queryString = " (PatientCPF:" + patientCPF;
            queryString += " AND Code:" + record.Code;
            queryString += " AND Hospital:" + record.Hospital.Key + " )";

            writer.DeleteDocuments(CreateQuery(queryString));
        }