Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Cant search on a different language with the low search extension

Status Resolved
Add-on / Version Publisher Low Search 2.0.2
Severity
EE Version 2.10.2

Rein

Mar 01, 2016

Taking this site http://g-s-v.nl/home

searching on the dutch version (Default) works fine, but changing to englisch not anymore. It does not the language code and the “zoeken” segment according the template below.

{exp:low_search:form result_page="zoeken"}
                                <i class="fa fa-search"></i><input value="{exp:low_search:keywords query="{segment_2}"}" type="text" name="keywords" id="keywords" placeholder="{phrase:zoeken}..">
                            {/exp:low_search:form}

Any ideas?

#1

BoldMinded (Brian)

Rein, I need much more information.

• Please provide an example search word in English, and in Dutch.

• I also don’t know what you the low_search:form tag example you included above is rendering. What is it currently rendering, and what is it you’re expecting it to render, e.g. what is not working about it?

• Please take a look at your exp_low_search_indexes table. Do you see rows with lang_id of 1 and 2? https://www.dropbox.com/s/l8y6vs41pnzs7mn/Screenshot 2016-03-01 08.55.48.png?dl=0

#2

BoldMinded (Brian)

Comment has been marked private.

#3

Rein

Hi Brain,

Well, the problem is not the search because that works.

When i`m on the dutch site http://g-s-v.nl/ the action url for the low search form is “http://g-s-v.nl/”. When im on the english site, the action url for the form is the current url, what is wrong. it should point out to http://g-s-v.nl/en.

Debugging your module i see that you use a function “replaceFormVariables()” to change all urls on the site. If i comment that out, the action url for the search will point only to http://g-s-v.nl/en and then the search works.

So there need to be a check on some forms, where the “replaceFormVariables()” function dont have to run.

What i now did is add this data element, what you add on every element you check, on my form

{exp:low_search:form result_page="zoeken/index" form_data-publisher-updated="true"}

Now the action url is correct “http://g-s-v.nl/en” but the url is redirecting to “http://g-s-v.nl/zoeken/eyJyZXN1bHRfcGFnZSI6InpvZWtlblwvaW5kZXgiLCJrZXl3b3JkcyI6ImdpZnRlZCJ9” And thats the dutch version. Adding the “en” prefix will fix the problem and it is searching the english version.

So i fix the issue with the url, but now the redirect is not working when searching. Looks like you or low search is not respecting the prefix “/en/” in the url.

let me know.

#4

Rein

Low search use the function ‘create_url’ to create the url.

$url = ee()->functions->create_url($url);

Can you modify, hook in to change that url?

#5

Rein

I fix it now by doing this in low_search in file mod.low_search.php on line 1748

// --------------------------------------
  // If URI isn't a full url, make it so
  // --------------------------------------
  if ( ! preg_match('/^https?:\/\//', $url))
  {
   if(isset(ee()->publisher_lib)) {
    $url = ee()->publisher_lib->lang_code.'/'.$url;
   }

   $url = ee()->functions->create_url($url);
  }

Ofcourse, this need to be fixed, by you or by low search, Know idea who…

#6

BoldMinded (Brian)

what version of Publisher are you using?

#7

Rein

1.6.8

#8

BoldMinded (Brian)

Would you mind upgrading to the latest version and checking again?

It sounds like you don’t want the prefix at all on the search form action url, right? If so, check out the last section in the docs https://boldminded.com/add-ons/publisher/template-tags/forms

Login to reply