public void IndexContent(IndexWriter indexWriter, JobAdSortContent content, bool isNew) { var document = new Document(); // ID var id = content.JobAd.Id.ToFieldValue(); var idField = new Field(SearchFieldName.Id, id, Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS); idField.setOmitTermFreqAndPositions(true); document.add(idField); // Handlers. _contentHandler.AddContent(document, content); _salaryHandler.AddContent(document, content); _createdTimeHandler.AddContent(document, content); _integratorHandler.AddContent(document, content); _jobTypesHandler.AddContent(document, content); // Save the document. if (isNew) { indexWriter.addDocument(document, _contentAnalyzer); } else { indexWriter.updateDocument(new Term(SearchFieldName.Id, id), document, _contentAnalyzer); } }
protected override void IndexContent(IndexWriter indexWriter, JobAdSortContent content, bool isNew) { _indexer.IndexContent(indexWriter, content, isNew); }