Gravatar for achmedrauff.abdulrahim@3ds.com

Question by Achmed Rauff, Apr 9, 2015 2:39 AM

When indexing web pages the Date Indexed and Date Modified fields contain the same date and time.

I am trying to sort web page results by Date. However when the web site is first indexed it appears the the Date Indexed and Date Modifed shows the current date and time that it was indexed/refreshed. Thus the results does not display chronological order. How do I get CES to pick this date up and tag it to the Date Modified field?

Gravatar for cbolduc@coveo.com

Comment by Carl Bolduc, Apr 9, 2015 8:57 AM

Which connector are you using to index those web pages?

Gravatar for achmedrauff.abdulrahim@3ds.com

Comment by Achmed Rauff, Apr 13, 2015 12:45 AM

I am using the web connector.

Gravatar for jfcadrin@coveo.com

Comment by JFCG, Apr 14, 2015 9:00 AM

Is the website in question externally accessible, Achmed, so that we might take a look?

Gravatar for achmedrauff.abdulrahim@3ds.com

Comment by Achmed Rauff, Apr 15, 2015 3:23 AM

Sorry I am afraid that it is not available publicly. But it is a wiki site that has a meta field for date. So if there is no other option but to create a post conversion script (VB preferred) how would it be. Assuming that I have already indexed the custom field @date.

2 Replies
Gravatar for vseguin@coveo.com

Answer by Vincent Séguin, Apr 9, 2015 7:14 AM

Hi,

You would have to create a PostConversion Script to parse the body and correctly set the ModifiedDate field. This is not a good idea though, because the index relies on the modified date for a few important things (such as the refresh dates). I would suggest creating your own field instead, and use the script to set the field value.

You can learn more about scripts here: http://onlinehelp.coveo.com/en/ces/7.0/administrator/addingapostconversionscript.htm http://onlinehelp.coveo.com/en/ces/7.0/administrator/aboutnetconversionscripts.htm

Gravatar for achmedrauff.abdulrahim@3ds.com

Comment by Achmed Rauff, Apr 14, 2015 2:51 AM

I wouldn't want to change the original index because its used for other interfaces as well. But what I have done is added a custom field to index the correct date field. Then I thought of tweaking to the sort by date control like below, tell me if this is feasible…

Gravatar for achmedrauff.abdulrahim@3ds.com

Comment by Achmed Rauff, Apr 17, 2015 4:34 AM

So we cant modify the sysdate with the post conversion script?

Gravatar for vseguin@coveo.com

Comment by Vincent Séguin, Apr 17, 2015 7:03 AM

You can, but it is preferable to not do it. Like said, creating your own field for it would be better.

Gravatar for achmedrauff.abdulrahim@3ds.com

Answer by Achmed Rauff, Apr 14, 2015 2:51 AM

<script runat="server">
    protected override void OnInitializeSettings(EventArgs p_Args)
    {
        // Sort search results by date by default, in descending order.
        // We first create a custom SortByFieldSetting instance and then add
        // it to the search interface settings.
        SortByFieldSetting setting = new SortByFieldSetting();
        if (!CustomFields.DATE)
        {
            setting.Field = CustomFields.SYSDATE;
        }
        else
        {
            setting.Field = CustomFields.DATE;
        }
        setting.Descending = true;
        State.Staging.Add(setting);

        // Call the original method to apply all the other search
        // interface settings.
        base.OnInitializeSettings(p_Args);
    }
</script>
Ask a question