コード例 #1
0
ファイル: SearchService.cs プロジェクト: Lietuva2/LT2
        private Lucene.Net.Documents.Document CreateDoc(MongoObjectId id, string text, string subject, EntryTypes type)
        {
            Lucene.Net.Documents.Document doc = new Lucene.Net.Documents.Document();

            doc.Add(new Lucene.Net.Documents.Field(
                        "text",
                        new System.IO.StringReader(text.StripHtml())));

            doc.Add(new Lucene.Net.Documents.Field(
                        "id",
                        id.ToString(),
                        Lucene.Net.Documents.Field.Store.YES,
                        Lucene.Net.Documents.Field.Index.UN_TOKENIZED));

            doc.Add(new Lucene.Net.Documents.Field(
                        "subject",
                        subject,
                        Lucene.Net.Documents.Field.Store.YES,
                        Lucene.Net.Documents.Field.Index.UN_TOKENIZED));

            doc.Add(new Lucene.Net.Documents.Field(
                        "type",
                        type.ToString(),
                        Lucene.Net.Documents.Field.Store.YES,
                        Lucene.Net.Documents.Field.Index.UN_TOKENIZED));

            // For the highlighter, store the raw text
            doc.Add(new Lucene.Net.Documents.Field(
                        "raw_text",
                        text.StripHtml(),
                        Lucene.Net.Documents.Field.Store.YES,
                        Lucene.Net.Documents.Field.Index.UN_TOKENIZED));

            return(doc);
        }
コード例 #2
0
        public static string GetControllerNameByEntryType(this HtmlHelper html, EntryTypes type)
        {
            if (type == EntryTypes.Issue)
            {
                return("Voting");
            }
            if (type == EntryTypes.User)
            {
                return("Account");
            }

            return(type.ToString());
        }
コード例 #3
0
ファイル: FileAccess.cs プロジェクト: iAmNima/TourPlannerApp
        private IEnumerable <FileInfo> GetFileInfos(string startFolder, EntryTypes searchType)
        {
            DirectoryInfo dir = new DirectoryInfo(startFolder);

            return(dir.GetFiles("*" + searchType.ToString() + ".txt", SearchOption.AllDirectories));
        }