Exemple #1
0
        private void IndexModuleData(LuceneController lc, int moduleId, OpenContentSettings settings)
        {
            bool index = false;

            if (settings.TemplateAvailable)
            {
                index = settings.Manifest.Index;
            }
            FieldConfig indexConfig = null;

            if (index)
            {
                indexConfig = OpenContentUtils.GetIndexConfig(settings.Template);
            }

            if (settings.IsOtherModule)
            {
                moduleId = settings.ModuleId;
            }
            lc.Store.Delete(new TermQuery(new Term("$type", OpenContentInfo.GetScope(moduleId, settings.Template.Collection))));
            OpenContentController occ = new OpenContentController(PortalSettings.Current.PortalId);

            foreach (var item in occ.GetContents(moduleId, settings.Template.Collection))
            {
                lc.Add(item, indexConfig);
            }
        }
        private void IndexModuleData(LuceneController lc, int moduleId, OpenContentSettings settings)
        {
            bool index = false;

            if (settings.TemplateAvailable)
            {
                index = settings.Manifest.Index;
            }
            FieldConfig indexConfig = null;

            if (index)
            {
                indexConfig = OpenContentUtils.GetIndexConfig(settings.Template.Key.TemplateDir);
            }

            if (settings.IsOtherModule)
            {
                moduleId = settings.ModuleId;
            }

            lc.Store.Delete(new TermQuery(new Term("$type", moduleId.ToString())));
            OpenContentController occ = new OpenContentController();

            foreach (var item in occ.GetContents(moduleId))
            {
                lc.Add(item, indexConfig);
            }
        }
Exemple #3
0
 /// <summary>
 /// Use this to
 /// </summary>
 /// <param name="list">The list.</param>
 /// <param name="indexConfig">The index configuration.</param>
 /// <param name="scope">The scope.</param>
 public void ReIndexModuleData(IEnumerable <IIndexableItem> list, FieldConfig indexConfig, string scope)
 {
     try
     {
         using (LuceneController lc = LuceneController.Instance)
         {
             lc.Store.Delete(new TermQuery(new Term("$type", scope)));
             foreach (var item in list)
             {
                 lc.Add(item, indexConfig);
             }
             lc.Store.Commit();
             lc.Store.OptimizeSearchIndex(true);
         }
     }
     finally
     {
         LuceneController.ClearInstance();
     }
 }