Jump to content
haha

i cannot search with chinese character

Recommended Posts

Hey, I think  i can not search with chinese character, after i input chinese character i can not got search result,there would be empty result

Share this post


Link to post
Share on other sites

Hello there! I can't seem to reproduce this -- searching with Chinese characters works just fine for me.

Could you describe in a bit more detail what, where and how you're doing this? Are you talking about search in admin, site (front-end) or..? And just to make sure it's not something that's changed (though I can't think of such a thing right now) could you please provide the version of PW installed.

Share this post


Link to post
Share on other sites

I'm talking about site front-end, (I just not have tried admin search)

there  http://tongcheji.com

as i input chinese word i would got none search result, you could reproduce on my website

the latest version of processwire i'm using.

Share this post


Link to post
Share on other sites

I just searched for: 游览本站 on your site and it returned one result.

Can you post the search term you are testing?

Share this post


Link to post
Share on other sites

好孩子

I just searched for: 游览本站 on your site and it returned one result.

Can you post the search term you are testing?

all right...   "好孩子"                   "石家庄市"             etc

Share this post


Link to post
Share on other sites

So perhaps you need to look at the code of your search.php template and see if the selector is including the fields where these words occur on your site.

$matches = $pages->find("title|body|sidebar~=$q, limit=50");

The default only searches the title, body and sidebar fields. Add any other relevant fields to that | separated list.

Does that help?

Share this post


Link to post
Share on other sites

So perhaps you need to look at the code of your search.php template and see if the selector is including the fields where these words occur on your site.

$matches = $pages->find("title|body|sidebar~=$q, limit=50");

The default only searches the title, body and sidebar fields. Add any other relevant fields to that | separated list.

Does that help?

 And all stuff of a website content is included with 'title body sidebar', how can i miss it? i'm not change the code of search.php

  • Like 1

Share this post


Link to post
Share on other sites

Are those search examples you gave complete, distinct "words", or are they part of a longer string of characters?

If the latter, then try changing the selector in the search.php file to:

$matches = $pages->find("title|body|sidebar%=$q, limit=50");

Note that I changed "~=" to "%="

Does that help?

Share this post


Link to post
Share on other sites

Are those search examples you gave complete, distinct "words", or are they part of a longer string of characters?

If the latter, then try changing the selector in the search.php file to:

$matches = $pages->find("title|body|sidebar%=$q, limit=50");

Note that I changed "~=" to "%="

Does that help?

it helps.   after i change this it works then.  does that give more Pressure to server?

Share this post


Link to post
Share on other sites

It will be somewhat slower, but unless you have a very large number of pages, I wouldn't worry too much about it. However, you might find that *= also works for you, and this doesn't have the speed issue because it makes use of the sql fulltext indexes. Experiment and see what works.

Have a read here: http://processwire.com/api/selectors/#operators

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...