OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



[Trouble] Search strings are ignored at HELP screen

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

[Trouble] Search strings are ignored at HELP screen

Postby suzuki@wul » Tue Mar 06, 2007 11:14 pm

I'm Suzuki at Waseda University Library in JAPAN.
We've just started using OJS in Japanese. Then I got the trouble of searching.

The search of JOURNAL CONTENT are able to handle Japanese characters properly.
But I couldn't search anything by Japanese phrase (I mean double byte characters,
not ASCII) at HELP.

For exaple; # means single Japanese character

Search string I input --> Result

"OJS##" --> "OJS"
"###" --> ""

As above, all the Japanese characters are ingored when search query runs.

Is there anyone who had the same kind of trouble?

I'm really glad if you help me.
Suzuki
suzuki@wul
 
Posts: 5
Joined: Tue Mar 06, 2007 10:41 pm
Location: Waseda University Library / JAPAN

Postby asmecher » Wed Mar 07, 2007 3:17 pm

Hi Suzuki,

Does your version of PHP have multibyte strings installed and enabled? If not, multibyte characters are likely to be interpreted as simple ASCII strings and when search strings are converted to lower-case they will become garbled.

Regards,
Alec Smecher
Open Journal Systems Team
---
Don't miss the First International PKP Scholarly Publishing Conference
July 11 - 13, 2007, Vancouver, BC, Canada
http://ocs.sfu.ca/pkp2007/
asmecher
 
Posts: 8860
Joined: Wed Aug 10, 2005 12:56 pm

Postby suzuki@wul » Thu Mar 08, 2007 12:58 am

Hi Alec,

Thank you for your reply.
We have exactly set multibyte support enabled on our PHP, so we can search japanese strings at JOURNAL CONTENT search.
This is not a critical trouble, but we'll investigate this more.

Regards,
Suzuki
suzuki@wul
 
Posts: 5
Joined: Tue Mar 06, 2007 10:41 pm
Location: Waseda University Library / JAPAN

Postby asmecher » Thu Mar 08, 2007 4:52 am

Hi Suzuki,

Please do (particularly classes/help/HelpTopicDAO.inc.php in the getTopicsByKeyword function). I assume that you've translated the help files into Japanese? If not, then of course the obvious answer would be that the multibyte strings you're searching for don't appear in the help files.

If you're modifying the help files, also make sure that the cache directory and its contents can be written to by the web server; otherwise it's possible that you're working on outdated cached versions of the help files.

Regards,
Alec Smecher
Open Journal Systems Team
---
Don't miss the First International PKP Scholarly Publishing Conference
July 11 - 13, 2007, Vancouver, BC, Canada
http://ocs.sfu.ca/pkp2007/
asmecher
 
Posts: 8860
Joined: Wed Aug 10, 2005 12:56 pm

Postby suzuki@wul » Thu Mar 29, 2007 7:58 pm

Hi Alec,

Finally, Mr. Matsuo, one of our development partners on our library systems,
made an adjustment in *HelpHandler.inc.php* and solved the problem.
I hope this change will help other multibyte users.


regards,
Suzuki
Waseda University Library

The revised code:
========================================================
<?php

/**
* HelpHandler.inc.php
*
* Copyright (c) 2003-2006 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* @package pages.help
*
* Handle requests for viewing help pages.
*
* $Id: HelpHandler.inc.php,v 1.14 2006/06/12 23:26:08 alec Exp $
*/

define('HELP_DEFAULT_TOPIC', 'index/topic/000000');
define('HELP_DEFAULT_TOC', 'index/toc/000000');

import('help.HelpToc');
import('help.HelpTocDAO');
import('help.HelpTopic');
import('help.HelpTopicDAO');
import('help.HelpTopicSection');

class HelpHandler extends Handler {

/**
* Display help table of contents.
*/
function index() {
HelpHandler::view(array('index', 'topic', '000000'));
}

function toc() {
parent::validate();

$templateMgr = &TemplateManager::getManager();
$templateMgr->assign_by_ref('helpToc', Help::getTableOfContents());
$templateMgr->display('help/helpToc.tpl');
}

/**
* Display the selected help topic.
* @param $args array first parameter is the ID of the topic to display
*/
function view($args) {
parent::validate();

$topicId = implode("/",$args);

$topicDao = &DAORegistry::getDAO('HelpTopicDAO');
$topic = $topicDao->getTopic($topicId);

if ($topic === false) {
// Invalid topic, use default instead
$topicId = HELP_DEFAULT_TOPIC;
$topic = $topicDao->getTopic($topicId);
}

$tocDao = &DAORegistry::getDAO('HelpTocDAO');
$toc = $tocDao->getToc($topic->getTocId());

if ($toc === false) {
// Invalid toc, use default instead
$toc = $tocDao->getToc(HELP_DEFAULT_TOC);
}

if ($topic->getSubTocId() != null) {
$subToc = $tocDao->getToc($topic->getSubTocId());
} else {
$subToc = null;
}

$relatedTopics = $topic->getRelatedTopics();

$topics = $toc->getTopics();

$templateMgr = &TemplateManager::getManager();
$templateMgr->assign('currentTopicId', $topic->getId());
$templateMgr->assign_by_ref('topic', $topic);
$templateMgr->assign('toc', $toc);
$templateMgr->assign('subToc', $subToc);
$templateMgr->assign('relatedTopics', $relatedTopics);
$templateMgr->assign('breadcrumbs', $toc->getBreadcrumbs());
$templateMgr->display('help/view.tpl');
}

/**
* Display search results for a topic search by keyword.
*/
function search() {
parent::validate();

$searchResults = array();

// CHG 20070320 H.Matsuo *** from ***
//$keyword = trim(String::regexp_replace('/[^\w\s\.\-]/', '', strip_tags(Request::getUserVar('keyword'))));
$keyword = trim(strip_tags(Request::getUserVar('keyword')));
// CHG 20070320 H.Matsuo *** to ***

if (!empty($keyword)) {
$topicDao = &DAORegistry::getDAO('HelpTopicDAO');
$topics = $topicDao->getTopicsByKeyword($keyword);

$tocDao = &DAORegistry::getDAO('HelpTocDAO');
foreach ($topics as $topic) {
$searchResults[] = array('topic' => $topic, 'toc' => $tocDao->getToc($topic->getTocId()));
}
}

$templateMgr = &TemplateManager::getManager();
$templateMgr->assign('showSearch', true);
$templateMgr->assign('pageTitle', Locale::translate('help.searchResults'));
$templateMgr->assign('helpSearchKeyword', $keyword);
$templateMgr->assign('searchResults', $searchResults);
$templateMgr->display('help/searchResults.tpl');
}

}

?>
===========================================================
suzuki@wul
 
Posts: 5
Joined: Tue Mar 06, 2007 10:41 pm
Location: Waseda University Library / JAPAN

Postby asmecher » Fri Mar 30, 2007 9:04 am

Hello Suzuki,

Are you sure multibyte string support is enabled in your version of PHP? The String::regexp_replace call should be UTF-8 aware.

Regards,
Alec Smecher
Open Journal Systems Team
---
Don't miss the First International PKP Scholarly Publishing Conference
July 11 - 13, 2007, Vancouver, BC, Canada
http://ocs.sfu.ca/pkp2007/
asmecher
 
Posts: 8860
Joined: Wed Aug 10, 2005 12:56 pm


Return to OJS Technical Support

Who is online

Users browsing this forum: Google [Bot] and 4 guests