1

I added a Content search webpart on my main site. This query has to show me all the subsbite which are created. It's working pretty well but sometimes when I have created a project, I have to wait more than 1h before to be able to see it in my webpart. So a simple question, how to refresh my lists quicker?

Thanks for your help

1

You cannot control SharePoint Online search indexing frequency. Sometimes you see new content in matter of minutes, sometimes it may take up to 24 hours. This is because SPO uses Continuous Crawl.

You can only ask content to be "reindexed", e.g., in list settings, but it only marks the list for reindexing the next time search crawl runs.

If you need guaranteed fresh results, you need to make direct queries via REST API, CSOM, or traditional Content Query instead of using CSWP.

0

I suggest using ajax Timer Class to refresh your webpart.

Here is an example shows an UpdatePanel control that displays a randomly generated stock price and the time that the stock price was generated. The Timer control updates the content in the UpdatePanel control every 10 seconds.

You can review Docs here for more details.

<%@ Page Language="C#" AutoEventWireup="true" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Timer Example Page</title>
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            OriginalTime.Text = DateTime.Now.ToLongTimeString();
        }

        protected void Timer1_Tick(object sender, EventArgs e)
        {
            StockPrice.Text = GetStockPrice();
            TimeOfPrice.Text = DateTime.Now.ToLongTimeString();
        }

        private string GetStockPrice()
        {
            double randomStockPrice = 50 + new Random().NextDouble();
            return randomStockPrice.ToString("C");
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <asp:Timer ID="Timer1" OnTick="Timer1_Tick" runat="server" Interval="10000" />

        <asp:UpdatePanel ID="StockPricePanel" runat="server" UpdateMode="Conditional">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="Timer1" />
        </Triggers>
        <ContentTemplate>
            Stock price is <asp:Label id="StockPrice" runat="server"></asp:Label><BR />
            as of <asp:Label id="TimeOfPrice" runat="server"></asp:Label>  
        </ContentTemplate>
        </asp:UpdatePanel>
        <div>
        Page originally created at <asp:Label ID="OriginalTime" runat="server"></asp:Label>
        </div>
    </form>
</body>
</html>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.