Author Topic: Search feature on website not working properly  (Read 1141 times)

Offline varjo

  • Posts: 8
Search feature on website not working properly
« on: October 30, 2017, 03:25:28 PM »
Hi

I have an issue with the search feature. It works fine on the English version of the site, but not on the Finnish version. Nothing seems to differ in the two index.php files.
The site is here: https://suomenimurikeskus.fi/pages/fi/etusivu.php

The code I have in the index.php for the search is:
Code: [Select]
<?php if (SHOW_SEARCH) { ?>
<div role="search" class="search_box">
<form name="search" action="<?php echo WB_URL?>/search/index.php" method="get">
<input type="hidden" name="referrer" value="<?php echo defined('REFERRER_ID') ? REFERRER_ID PAGE_ID?>" />
<label><span style="display:none;"><?php echo $TEXT['SEARCH']; ?></span><input type="text" value="<?php if (isset($_GET['string'])) {echo strip_tags($_GET['string']);} else {echo $TEXT['SEARCH']; } ?>" name="string" class="searchstring" onfocus="if (this.value=='<?php echo $TEXT['SEARCH']; ?>') {this.value='';}" /></label>
<input type="image" class="submitbutton" alt="Etsi" />
</form>
</div>
<?php ?>


Thanks in advance.

Offline jacobi22

  • Posts: 5843
  • Gender: Male
  • Support also via PM or EMail
    • Jacobi22
Re: Search feature on website not working properly
« Reply #1 on: October 30, 2017, 03:53:56 PM »
we need more informations
- WB- and PHP-Version
- any errors in the log?
- using mysql-strict mode??  (see information in the info-window at the bottom) see picture here
- pls give us the first 3 lines in WB-Options - advanced - Search settings (visibility, template, header)
- what is default language in WB-Options and language on the finnish pages (has everything the correct settings?)
- what is the setting for Search in the page setting of every finnish page?

what i see: a redirect to the start page, if i use search on Finnish pages
Wer nicht will, findet Gründe, wer will, findet Wege.

Offline varjo

  • Posts: 8
Re: Search feature on website not working properly
« Reply #2 on: October 31, 2017, 09:45:58 AM »
we need more informations
- WB- and PHP-Version
- any errors in the log?
- using mysql-strict mode??  (see information in the info-window at the bottom) see picture here
- pls give us the first 3 lines in WB-Options - advanced - Search settings (visibility, template, header)
- what is default language in WB-Options and language on the finnish pages (has everything the correct settings?)
- what is the setting for Search in the page setting of every finnish page?

what i see: a redirect to the start page, if i use search on Finnish pages

WB-version is 2.8.3+SP7 and PHP-version is PHP5.6.30-0+deb8u1. Also non-strict mode is on. The default language is Finnish and Finnish is also set as the language on the Finnish pages. Searching is enabled.

The settings in advanced search settings are set like this:
Visibility: Public
Template: System default (Which is the one set on the Finnish child pages)
Header:
Code: [Select]
<h1>[TEXT_SEARCH]</h1>

<form name="searchpage" action="[WB_URL]/search/index.php" method="get">
<table cellpadding="3" cellspacing="0" border="0" width="500">
<tr>
<td>
<input type="hidden" name="search_path" value="[SEARCH_PATH]" />
<input type="text" name="string" value="[SEARCH_STRING]" style="width: 100%;" />
</td>
<td width="150">
<input type="submit" value="[TEXT_SEARCH]" style="width: 100%;" />
</td>
</tr>
<tr>
<td colspan="2">
<input type="radio" name="match" id="match_all" value="all"[ALL_CHECKED] />
<label for="match_all">[TEXT_ALL_WORDS]</label>
<input type="radio" name="match" id="match_any" value="any"[ANY_CHECKED] />
<label for="match_any">[TEXT_ANY_WORDS]</label>
<input type="radio" name="match" id="match_exact" value="exact"[EXACT_CHECKED] />
<label for="match_exact">[TEXT_EXACT_MATCH]</label>
</td>
</tr>
</table>

</form>

<hr />
   

Offline varjo

  • Posts: 8
Re: Search feature on website not working properly
« Reply #3 on: October 31, 2017, 09:56:38 AM »
I just noticed that we have a redirect page set on this website, and its language is set to Finnish. It redirects to the Finnish frontpage. When I set its language to English, the search stops working in the English sites. If it's set to some other language, the search works on both versions.

Why does this happen?

Offline jacobi22

  • Posts: 5843
  • Gender: Male
  • Support also via PM or EMail
    • Jacobi22
Re: Search feature on website not working properly
« Reply #4 on: October 31, 2017, 12:22:49 PM »
i'll try to rebuild a test scenario with your datas, pls give me some minutes

Quote
I just noticed that we have a redirect page set on this website, and its language is set to Finnish. It redirects to the Finnish frontpage. When I set its language to English, the search stops working in the English sites. If it's set to some other language, the search works on both versions.

Why does this happen?

a redirect to the start page is normalize a way out, if something goes wrong, for example: a broken intern link
if the system doesnt found the next target
Wer nicht will, findet Gründe, wer will, findet Wege.

Offline jacobi22

  • Posts: 5843
  • Gender: Male
  • Support also via PM or EMail
    • Jacobi22
Re: Search feature on website not working properly
« Reply #5 on: October 31, 2017, 12:37:45 PM »
it works for me local and now also online on your page - did you change anything?? i remember, that i've the same problem some day's ago, when you start this thread here

see https://i.gyazo.com/12f75a41627d99400f685d52d097320e.png

P.S.: nice work on this page, looks very good  (Y)

another P.S.:
Quote
I just noticed that we have a redirect page set on this website, and its language is set to Finnish

redirect from?? do you mean a .htaccess-redirect?
Wer nicht will, findet Gründe, wer will, findet Wege.

Offline zirzy

  • Posts: 168
Re: Search feature on website not working properly
« Reply #6 on: October 31, 2017, 02:39:05 PM »
Hi jacobi22,

Redirect is set trough WB. New page -> redirect (first in tree). And from redirect page -> settings -> page template -> redirect (index.php includes header redirect). We have been redirecting like this for ten years in some cases (relic)  :-D  There hasn't been any problems with search and redirect on other sites..

Offline zirzy

  • Posts: 168
Re: Search feature on website not working properly
« Reply #7 on: October 31, 2017, 02:51:34 PM »
..So the problem is still there.

If redirect page is set on FIN language -> Search on English pages works correct, but not on Finnish pages. If we set redirect page to English ->The search on Finnish pages is correct but not English..

If set redirect page, lets say, on Deutch -> Search works correct on both languages, but if you go to https://suomenimurikeskus.fi it don't redirect to https://suomenimurikeskus.fi/pages/fi/etusivu.php at all..

Offline jacobi22

  • Posts: 5843
  • Gender: Male
  • Support also via PM or EMail
    • Jacobi22
Re: Search feature on website not working properly
« Reply #8 on: October 31, 2017, 03:24:29 PM »
not sure, that i understand everything correct, sorry for that   :oops: :oops:

i try it with screen shots

a basic construct like this -> https://i.gyazo.com/022da21448aefe45012cbfb2ccb8b4c7.png

Pages with name FI and GE are type = menu-link with a redirect to the start-page of this language like this picture -> https://i.gyazo.com/89fa8df64cb61e5e8ab7715c8a378619.png

if you have a tree in pages overview like this (FIN-Pages in the top + first page is a menu-link) AND WB -Default language in WB-Page-Settings is FIN, than you need no other redirect's

whats the setting for Homepage Redirect in advanced WB-Options -> https://i.gyazo.com/7a50f61894efcc90ce2b1f21078aeb5f.png
set is to disable pls, if it's enabled yet
Wer nicht will, findet Gründe, wer will, findet Wege.

Offline zirzy

  • Posts: 168
Re: Search feature on website not working properly
« Reply #9 on: November 01, 2017, 09:57:39 AM »
Thanks for help Jacobi22! Now it's working correct again  (Y) (Y) The problem was that the fi was not menu link :-D Like i said that redirect was a relic from ten years ago :-D