示例#1
0
        /// <summary>
        /// Create the Lucene document and index fields common to a ProjectAsset object. 
        /// Stories, Defects, Requests, and Issues inherit from ProjectAsset
        /// </summary>
        /// <param name="projectAsset">ProjectAsset to index</param>
        /// <returns></returns>
        private Document CreateDocument(ProjectAsset projectAsset)
        {
            Document doc = new Document();
            doc.Add(UnIndexed("URL", _v1Url + "/assetdetail.v1?oid=" + projectAsset.ID));
            doc.Add(Keyword("ID", projectAsset.DisplayID));
            doc.Add(UnStored("OID", projectAsset.ID));
            doc.Add(Text("type", projectAsset.GetType().Name));
            doc.Add(Text("isClosed", projectAsset.IsClosed.ToString()));
            doc.Add(Text("Name", projectAsset.Name));
            doc.Add(UnStored("Description", projectAsset.Description));
            if(null != projectAsset.Project)
                doc.Add(Text("Project", projectAsset.Project.Name));

            StringBuilder noteBuffer = new StringBuilder();
            foreach (Note note in projectAsset.GetNotes(null))
                noteBuffer.Append(note.Name);
            doc.Add(UnStored("Notes", noteBuffer.ToString()));

            return doc;
        }
示例#2
0
 private static string Reference(ProjectAsset asset)
 {
     return string.Format("\"{0}\" ({1}/{2})", asset.Name, asset.DisplayID, asset.ID);
 }