Problem with search after upgrading to OJS 3.1.0.1

Hi all,

Here is the search SQL: https://github.com/pkp/ojs/blob/master/classes/search/ArticleSearchDAO.inc.php#L28.
I.e. you could test it and run this SQL:

SELECT
o.submission_id,
MAX(s.context_id) AS journal_id,
MAX(i.date_published) AS i_pub,
MAX(ps.date_published) AS s_pub,
COUNT(*) AS count
FROM
submissions s,
published_submissions ps,
issues i,
submission_search_objects o NATURAL JOIN submission_search_object_keywords o0 NATURAL JOIN submission_search_keyword_list k0
WHERE
s.submission_id = o.submission_id AND
s.status = 3 AND
ps.submission_id = s.submission_id AND
i.issue_id = ps.issue_id AND
i.published = 1 AND k0.keyword_text = ? AND i.journal_id = ?
GROUP BY o.submission_id
ORDER BY count DESC
LIMIT 500

Just change the signs “?” with the appropriate keyword (e.g. ‘soil’ or ‘childbearing’) and journal ID.

Note also, that searching after ‘soil’ will only return those containing the word ‘soil’ and not those only containing the word ‘soils’. To find them too you would need to use
AND k0.keyword_text LIKE 'soil%'
in the SQL above.

Maybe first to check if the keywords are indexed correctly – this seems not to be right. For this you would need to take a look in the DB tables submission_search_*, where the keywords are indexed. You can e.g. see this with this SQL:

SELECT
o.submission_id
FROM
submission_search_objects o NATURAL JOIN submission_search_object_keywords o0 NATURAL JOIN submission_search_keyword_list k0
WHERE
k0.keyword_text = ?
GROUP BY o.submission_id

Again, please replace the sign “?” with the keyword (e.g. ‘soil’) or use LIKE 'soil%'.

If everything is all right in those DB tables (which I do not think is), then we can think/see further – i.e. we will have to go step by step to figure out what is the problem…

Best,
Bozana