Exemple #1
0
        public void IndexContent(IndexWriter indexWriter, JobAdSearchContent 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);
            _locationHandler.AddContent(document, content);
            _salaryHandler.AddContent(document, content);
            _industryHandler.AddContent(document, content);
            _jobTypesHandler.AddContent(document, content);
            _createdTimeHandler.AddContent(document, content);
            _communityHandler.AddContent(document, content);
            _featuredHandler.AddContent(document, content);

            // Save the document.

            if (isNew)
            {
                indexWriter.addDocument(document, _contentAnalyzer);
            }
            else
            {
                indexWriter.updateDocument(new Term(SearchFieldName.Id, id), document, _contentAnalyzer);
            }
        }
Exemple #2
0
 protected override void IndexContent(IndexWriter indexWriter, JobAdSearchContent content, bool isNew)
 {
     _indexer.IndexContent(indexWriter, content, isNew);
 }