hi,

I have a multilingual site built with i18n.
When i do a normal search, my site searchs for the nodes with the defined language and it is ok.

But, when i do a search trougth services, using search.nodes, the service returns only the nodes with the main language, the others never show up, even if I change the language.

Is there a way to correct this issue?

thanks in advance.

Comments

marcingy’s picture

Status: Active » Closed (duplicate)

Services currently does not support translations there is an issue http://drupal.org/node/208939 which can be used for discussion of a translation service. All patches to help this become a reality are of course welcome ;)

carvalhar’s picture

i tried to understand the code behind search module and search service but i still can't understant it very well.

i don't know how to implement the search hook to respect the language, as when you use the site normally.
(making it more clear: i can find my nodes with i18n trough search module, but not with search service)

at search-service.inc there is a call to:
$results = module_invoke('node', 'search', 'search', $keys);

but in node.module, there is
function node_search($op = 'search', $keys = NULL) { [...] and there in the case 'search' , the actual search is being made, but i don't know where at the code the i18n affects.

i can't see the difference between the search made trougth search module (normal search form from site) and the search made with services.

any tip?

carvalhar’s picture

i'm tried to setup a small service to change the language, but it isn't respect by search service:

/**
* Callback for language.switch service.
*/
function language_service_switch($theLanguage) {
global $language;
global $user;
$user->language = $theLanguage;
$language->language = $theLanguage;
return $user->language;
}

how can i define $language?

thanks

hveiras’s picture

I could enable search in multilanguage through the services by enabling the option "All content. No language conditions apply" located in Administer->Site configuration->languages and selecting the tab Multilingual Systems.