More in this section
Forums / Developing with Sitefinity / Clear search index programatically

Clear search index programatically

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
3 posts, 0 answered
  1. pajri
    pajri avatar
    0 posts
    25 Jan 2017
    12 Oct 2017
    Link to this post


    Currently I'm using sitefinity 9.2. 

    How to clear searc index programatically ?

  2. Jonathan
    Jonathan avatar
    119 posts
    19 Dec 2012
    12 Oct 2017 in reply to pajri
    Link to this post

    Here is the documentation for search index CRUD operations.  These methods will allow for deleting and/or updating search indexes programmaticlly.

  3. Nidhi
    Nidhi avatar
    40 posts
    20 Jul 2010
    24 Oct 2017
    Link to this post

    You can try something like this:

    var queryBuilder = Telerik.Sitefinity.Abstractions.ObjectFactory.Resolve<IQueryBuilder>();
            var searchQuery = queryBuilder.BuildQuery("test", new string[] { "content" });
            searchQuery.IndexName = searchIndexName;
            searchQuery.Skip = 0;
            searchQuery.Take = 10;
            searchQuery.HighlightedFields = new List<string>() { "content" };

            IResultSet searchResult = ServiceBus.ResolveService<ISearchService>().Search(searchQuery);
            foreach (var item in searchResult)
                ServiceBus.ResolveService<ISearchService>().RemoveDocument(searchIndexName, item.IdentityField);

3 posts, 0 answered