/// <summary> /// Adds the new manual to index. /// </summary> /// <param name="manual">The manual.</param> public void AddNewManualToIndex(Manual manual) { AddLuceneIndex(new List<Manual> { manual }); }
private void AddToLuceneIndex(Manual manual, IndexWriter writer) { Document doc = new Document(); string comments = string.Join(" ", manual.Comments.Select(x => x.Description).ToArray()); string tags = string.Join(" ", manual.Tags.Select(x => x.Name).ToArray()); doc.Add(new Field("Id", manual.Id.ToString(), Field.Store.YES, Field.Index.NOT_ANALYZED)); doc.Add(new Field("ManualName", manual.Name, Field.Store.YES, Field.Index.ANALYZED)); doc.Add(new Field("ManualDescription", manual.Description, Field.Store.YES, Field.Index.ANALYZED)); doc.Add(new Field("Category", manual.Category.Name, Field.Store.YES, Field.Index.ANALYZED)); doc.Add(new Field("Comments", comments, Field.Store.YES, Field.Index.ANALYZED)); doc.Add(new Field("Tags", tags, Field.Store.YES, Field.Index.ANALYZED)); writer.AddDocument(doc); }