当前位置: 首页>>代码示例>>C#>>正文


C# TriglavBL.getAllPitanja方法代码示例

本文整理汇总了C#中Data.EntityFramework.BLL.TriglavBL.getAllPitanja方法的典型用法代码示例。如果您正苦于以下问题:C# TriglavBL.getAllPitanja方法的具体用法?C# TriglavBL.getAllPitanja怎么用?C# TriglavBL.getAllPitanja使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Data.EntityFramework.BLL.TriglavBL的用法示例。


在下文中一共展示了TriglavBL.getAllPitanja方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetDirectoryPitanja

        /// <summary>
        /// Directory Pitanja
        /// </summary>
        /// <param name="postVrstaId"></param>
        /// <returns></returns>
        public static Directory GetDirectoryPitanja()
        {
            using (TriglavBL temp = new TriglavBL())
               {

               Directory directoryPitanja = FSDirectory.Open(new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "Pitanja"));
               Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_30);

               var writer = new IndexWriter(directoryPitanja, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);

               List<Post> SvaPitanja = temp.getAllPitanja();
               foreach (var post in SvaPitanja)
               {
                   //Add & boost
                   var clanak = new Document();
                   clanak.Add(new Field("id", Convert.ToString(post.id), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS, Field.TermVector.NO));
                   clanak.Add(new Field("PostVrsta", Convert.ToString(post.PostVrsta), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
                   clanak.Add(new Field("Naslov", post.Naslov, Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
                   clanak.GetField("Naslov").Boost = (2.0F);
                   clanak.Add(new Field("Sadrzaj", post.Sadrzaj, Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
                   clanak.GetField("Sadrzaj").Boost = (1.2F);
                   clanak.Add(new Field("Sazetak", post.Sazetak, Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
                   clanak.GetField("Sazetak").Boost = (1.5F);
                   clanak.Add(new Field("Tagovi", post.Tagovi, Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
                   clanak.GetField("Tagovi").Boost = (2.5F);
                   clanak.Add(new Field("VlasnikId", Convert.ToString(post.VlasnikID), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
                   clanak.Add(new Field("VlasnikNadimak", Convert.ToString(post.VlasnikNadimak), Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
                   clanak.Add(new Field("DatumKreiranja", Convert.ToString(post.DatumKreiranja), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
                   clanak.Add(new Field("DatumZadnjeIzmjene", Convert.ToString(post.DatumZadnjeIzmjene), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
                   clanak.Add(new Field("DatumZadnjeAktivnosti", Convert.ToString(post.DatumZadnjeAktivnosti), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
                   clanak.Add(new Field("PrihvaceniOdgovori", Convert.ToString(post.PrihvaceniOdgovori), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
                   clanak.Add(new Field("BrojOdgovora", Convert.ToString(post.BrojOdgovora), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
                   clanak.Add(new Field("BrojKomentara", Convert.ToString(post.BrojKomentara), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
                   clanak.Add(new Field("BrojOmiljenih", Convert.ToString(post.BrojOmiljenih), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
                   clanak.Add(new Field("BrojPregleda", Convert.ToString(post.BrojPregleda), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
                   clanak.Add(new Field("BrojPoena", Convert.ToString(post.BrojPoena), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
                   clanak.Add(new Field("Likes", Convert.ToString(post.Likes), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
                   clanak.Add(new Field("Unlikes", Convert.ToString(post.Unlikes), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
                   clanak.Add(new Field("PromijenioID", Convert.ToString(post.PromijenioID), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
                   clanak.Add(new Field("RoditeljskiPostID", Convert.ToString(post.RoditeljskiPostID), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
                   clanak.Add(new Field("BrojRangiranja", Convert.ToString(post.BrojRangiranja), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
                   clanak.Add(new Field("PrihvacenaIzmjena", Convert.ToString(post.PrihvacenaIzmjena), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
                   clanak.Add(new Field("Broj_Razgovora", Convert.ToString(post.Broj_Razgovora), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));

                   writer.AddDocument(clanak);
               }

               writer.Optimize();
               writer.Dispose();
               return directoryPitanja;
               }
        }
开发者ID:elvis-kadic,项目名称:FIT_KMS,代码行数:57,代码来源:Indexing.cs


注:本文中的Data.EntityFramework.BLL.TriglavBL.getAllPitanja方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。