Examine - call indexall() method but index files are about 1k each
HI guys,
Currently I am using umbraco 4.5 and examine CR3 to do index and search. I tried to use indexall() and reindex (...) method to re-index content pages. But I noticed the size of index files were very small and they were about 1k each. Fortunately after deleting all the files in the index folder (eg:App_data/examine/internal/*.*) and re-publishing pages in the whole site, the size of index files became 230 K+.
Or is there any setting I missed here (suppose that site will be re-index automatically regularly)?
publicvoid Index_Reindex_Content()
{
var searcher = (UmbracoExamineSearcher)ExamineManager.Instance.SearchProviderCollection["CWSSearcher"];
Trace.WriteLine("Searcher folder is " + searcher.LuceneIndexFolder.FullName);
var s = searcher.GetSearcher();
//first delete all 'Content' (not media). This is done by directly manipulating the index with the Lucene API, not examine!var r = IndexReader.Open(s.GetIndexReader().Directory(), false);
var contentTerm = new Term(UmbracoExamineIndexer.IndexTypeFieldName, IndexTypes.Content);
var delCount = r.DeleteDocuments(contentTerm);
r.Commit();
r.Close();
//make sure the content is gone. This is done with lucene APIs, not examine!var collector = new AllHitsCollector(false, true);
var query = new TermQuery(contentTerm);
s = searcher.GetSearcher(); //make sure the searcher is up do date.
s.Search(query, collector);
Assert.AreEqual(0, collector.Count);
Where's this code running, in your custom indexer or just in an application consuming the indexer & searcher?
Depending on how you're running examine, if you're running it in async mode then you end up with .add and .del files which represent all the index changes which need to be done. These will be processed when the timer runs. You shouldn't need to be interacting with Lucene at all.
Examine - call indexall() method but index files are about 1k each
Where's this code running, in your custom indexer or just in an application consuming the indexer & searcher?
Depending on how you're running examine, if you're running it in async mode then you end up with .add and .del files which represent all the index changes which need to be done. These will be processed when the timer runs.
You shouldn't need to be interacting with Lucene at all.
is working on a reply...