You are viewing limited content. For full access, please sign in.

Question

Question

Weblink search customization order by most recent

asked on July 16, 2015 Show version history

Is there a way to change the search results within Weblink to be ordered by creation/modified date? This would be for Weblink v9. This would be set as default when searching instead of the default by name.

0 0

Answer

SELECTED ANSWER
replied on July 21, 2015 Show version history

There is another way to get this to work that you can try. Do not make any modifications to Search.aspx but instead add one line of code to Search.aspx.vb. At line ~305, you should see

MySearchResultsBrowser.Columns = GetDisplayColumns(AdditionalColumns)
If Not IsNothing(Session(SearchKey)) Then
...

Directly after that first line (before the If Not statement), add the line

MySearchResultsBrowser.DefaultSortColumn = Column_Type.COLUMN_TYPE_LASTDATE

The final code should look like

MySearchResultsBrowser.Columns = GetDisplayColumns(AdditionalColumns)
MySearchResultsBrowser.DefaultSortColumn = Column_Type.COLUMN_TYPE_LASTDATE
If Not IsNothing(Session(SearchKey)) Then

Then rebuild the project and reset IIS. This should successfully set the default sort column to Date modified. 

2 0
replied on July 22, 2015 Show version history

Does this order the documents by most recent first or oldest at the top of the list?

 

edit: That worked thanks!

0 0
replied on February 20, 2017

when you said rebuild trhe project, which project are you refer to?

WebLink.vbproj

or

Search.aspx.vb

 

0 0
replied on February 21, 2017

Rebuild the whole WebLink.vbproj

1 0
replied on February 23, 2017

I tried to rebuild it but it creates WebLink.vbproj.user in place and another file of the saved project

 

is there a parameters I need to modified to get the WebLink.vbproj rebuild

0 0
replied on February 23, 2017

they said add one line of code to Search.aspx.vb. At line ~305, but this file is not listed in the WebLink.vbproj. I modified the file directly and buid the solution. but it create WebLink.vbproj.user and the file WebLink.vbproj are not really been modified.

I restarted IIS, but this is still not working

0 0

Replies

replied on February 23, 2017

OK got it, in my situation the search was done on the welcome page, so the file I should modified was the welcome.aspx.vb at line 61 (second line in the following code)

 MySearchResultsBrowser.Columns = WebLinkControls.ColumnSelect8.GetSelectedColumns(Page, m_Conn, "SearchColumns", Nothing)
            MySearchResultsBrowser.DefaultSortColumn = Column_Type.COLUMN_TYPE_LASTDATE
            MySearchResultsBrowser.Visible = False ' SCR 124092

And I build back the weblink project, restart IIS and now it works

1 0
replied on July 17, 2015

I have tried to add DefaultSortColumn="COLUMN_TYPE_LASTDATE" to the Search.aspx file and I receive a compilation error. Is there a specific file that I need to have this placed in or is my syntax incorrect?

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.