function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ShamilShamil 

Salesforce Knowledge: articleList sortby issue

Problem # 1 is that sortBy attribute of the articleList component stops working after a keyword is specified. For instance, the code below renders the same result regardless of the sorting method:

 

<apex:page >
	<knowledge:articleList articleVar="article"
				sortBy="title"
				keyword="yourKeyword"
			>
				<li >
				<a href="{!URLFOR($Action.KnowledgeArticle.View, article.id) + '&popup=true'}" target="_blank">
				{!article.title}</a>
				</li>
				<apex:variable var="isArticlesResult" value="true"/>
						</knowledge:articleList>
	<br/>
	<knowledge:articleList articleVar="article"
				sortBy="mostViewed"
				keyword="yourKeyword"
			>
				<li >
				<a href="{!URLFOR($Action.KnowledgeArticle.View, article.id) + '&popup=true'}" target="_blank">
				{!article.title}</a>
				</li>
				<apex:variable var="isArticlesResult" value="true"/>
			</knowledge:articleList>
	<br />
	<knowledge:articleList articleVar="article"
				sortBy="lastUpdated"
				keyword="yourKeyword"
			>
				<li >
				<a href="{!URLFOR($Action.KnowledgeArticle.View, article.id) + '&popup=true'}" target="_blank">
				{!article.title}</a>
				</li>
				<apex:variable var="isArticlesResult" value="true"/>
	</knowledge:articleList>                   
</apex:page>

 

 

Whereas if keyword is removed sorting starts working.

 

Problem # 2 is that when keyword is specified, it is unclear what sorting criteria is used (it's not one of the 3 documented)

API version used for testing: 21, 22
Best Answer chosen by Admin (Salesforce Developers) 
francoisLfrancoisL

Shamil, 

 

About problem 1, what you describe is true. This is the actual behavior. If a keyword is present, sort attribute is ignored.

 

About problem 2, when you have a keyword, the sort is by keyword relevance. 

 

I will ask to update the documentation to reflect the actual behavior. We may also think to update in the coming releases. 

 

Thanks. 

All Answers

francoisLfrancoisL

Hi Shamil, 

 

Thanks for your feedback. I don't have the answer but I will be back next week with it.

 

 

francoisLfrancoisL

Shamil, 

 

About problem 1, what you describe is true. This is the actual behavior. If a keyword is present, sort attribute is ignored.

 

About problem 2, when you have a keyword, the sort is by keyword relevance. 

 

I will ask to update the documentation to reflect the actual behavior. We may also think to update in the coming releases. 

 

Thanks. 

This was selected as the best answer
ShamilShamil

Francois,

 

Thanks for your reply.

On #1, it is definitely something that many customers want to have, because it gets somewhat confusing for the end users when sorting only works without a keyword. Also, allowing other ways of sorting, such as by rating would greatly help too - there's a plenty of requests for this as well. I'm sure this all is on your internal to-do list :smileywink: and there are technical reasons for such behavior, but I just wanted to add my 2 cents.

chris_parxchris_parx

francoisL wrote:

 

About problem 2, when you have a keyword, the sort is by keyword relevance. 

 

 


I already read the doc and got the same description but I don't understand what it is meant with the "keyword relevance". What does that mean concrete? What are the criterias to be see as "related article" ?

francoisLfrancoisL

Keyword relevance means that article are sorted based on salesforce relevance algorithm.

 

salesforce relevance algorithm uses mainly search term match, popularity. 

 

You can have more details here: https://help.salesforce.com/apex/HTViewHelpDoc?id=knowledge_article_search.htm&language=en_US .