Developer forum

Forum » CMS - Standard features » Index raw data

Index raw data

Nuno Aguiar
Reply

Hi,

 

Is there a way to expose the index's raw data? Much like the query sandbox used to do as a proof of concept.

 

Best Regards,

Nuno Aguiar


Replies

 
Nicolai Høeg Pedersen
Reply

Hi Nuno

In 8.7 it is called the Querypublisher and does just that.

BR Nicolai

 
Nuno Aguiar
Reply

Hi Nicolai,

 

I though as much, but how can I expose the entire index result. I was trying this but always get a null results

 

@inherits RazorTemplateBase<RazorTemplateModel<Template>>
@using Dynamicweb.Rendering;
@using System.Collections.Specialized;

@{
    Dynamicweb.Querying.IQueryResult queryResult = GetValue("QueryResultItem") as Dynamicweb.Querying.IQueryResult;

 

    if (queryResult != null)
    {
        <pre>Count: @queryResult.Count</pre>
        <pre>Total count: @queryResult.TotalCount</pre>

        <pre>@Newtonsoft.Json.JsonConvert.SerializeObject(queryResult.QueryResult, Newtonsoft.Json.Formatting.Indented)</pre>
    }
    else
    {
        <pre>null query result</pre>
    }

}

 

 

Is this accurate?

 

Best Regards,

Nuno Aguiar

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

Take a look at the default tempate - find it attached.

Votes for this answer: 1
 
Nuno Aguiar
Reply

ok, thanks

 
Martin Grønbekk Moen
Martin Grønbekk Moen
Reply

You dont get the total number of items in the query. You get total number of pages, and total number of items on a page.

Ex. from a query result you get 10 pages, with 10 items on each page. To find the total number of items you cant just say 10 x 10 = 100, but since there can be all from 1 to 10 items on the last page, the total can be all from 91 to 100.

Would be nice to get the total number of items in the query result.

 
Nicolai Pedersen
Reply

Hm, good point - just added the tag QueryResult.TotalCount out with the next update of Dynamicweb.QueryPublisher (1.1.1), TFS#35141

BR Nicolai

 
Martin Grønbekk Moen
Martin Grønbekk Moen
Reply

Perfect, and thanks for quick action :)

 

You must be logged in to post in the forum