Quantcast
Channel: PKP Community Forum - Latest topics
Viewing all articles
Browse latest Browse all 27304

[Solved]Sorting result of simple search form return [OJS 2.4.7.1]

$
0
0

@anzewill wrote:

Hi Everyone:

We are currently using the simple search function in OJS 2.4.7.1 as a index of some keywords, the result is currently randomly ordered, i have read through several posts and the solution seems have to use lucene plugin which requires a solr server, however our web hosting service provider does not allow us to install one.

Just wondering if it is possible to do some code modification to just sort the result by published date, so i changed a line of code in ArticleSearchDAO.inc

	$result =& $this->retrieveCached(
		'SELECT	o.article_id
		FROM	articles a,
			published_articles pa,
			issues i,
			article_search_objects o NATURAL JOIN ' . $sqlFrom . '
		WHERE	pa.article_id = a.article_id AND
			a.status = ' . STATUS_PUBLISHED . ' AND
			pa.article_id = o.article_id AND
			i.issue_id = pa.issue_id AND
			i.published = 1 AND ' . $sqlWhere . '
		GROUP BY o.article_id
		ORDER BY pa.date_published ASC
		LIMIT ' . $limit,
		$params,
		3600 * $cacheHours // Cache for 24 hours
	);

From ORDER BY COUNT DESC
to ORDER BY pa.date_published ASC
and delete COUNT(*) AS count

Now in the search result articles seems all in a correct order, just a simple solution to share, if there is a risk please let me know

Thanks for reading

Evo

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 27304

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>