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.
Question
Question
Weblink search customization order by most recent
Answer
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.
Does this order the documents by most recent first or oldest at the top of the list?
edit: That worked thanks!
when you said rebuild trhe project, which project are you refer to?
WebLink.vbproj
or
Search.aspx.vb
Rebuild the whole WebLink.vbproj
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
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
Replies
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
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?