Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Search plugin (I18N)
Hello!
(2013-02-25, 03:53:25)mvlcek Wrote: As far as I know, the 1.8.x versions should work.
I'll try to support 1.9.x in the next release of I18N Search.

Thanks for your quick response! JQuery 1.8.3 works fine Smile
Reply
(2013-02-25, 14:14:52)andyash Wrote: I have put certain tags in my pages. I am not using a tag cloud anywhere but have inserted words in my content corresponding to the tags. I want to link these words so that clicking on them will take the user to a page which contains excerpts of all pages with the same tag.

What is the link code to be used here?

The link is <URL of search page>?words=<word>, e.g. if your search result page is http://myhost.com/search and you search for computer then the whole link would be:
Code:
<a href="http://myhost.com/search?words=computer">computer</a>
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
(2013-02-26, 03:50:37)mvlcek Wrote:
(2013-02-25, 14:14:52)andyash Wrote: I have put certain tags in my pages. I am not using a tag cloud anywhere but have inserted words in my content corresponding to the tags. I want to link these words so that clicking on them will take the user to a page which contains excerpts of all pages with the same tag.

What is the link code to be used here?

The link is <URL of search page>?words=<word>, e.g. if your search result page is http://myhost.com/search and you search for computer then the whole link would be:
Code:
<a href="http://myhost.com/search?words=computer">computer</a>
Thanks. This worked well.
Reply
Hello.
please you if I have to page through the search, eg (% searchresults tags = News%) both edit or disturb Generated title "Search results".
When I click on a search result, so I put url for example "?lang=cs" - what to set it to not display.
Reply
Maybe this?
Code:
(% searchresults tags=news HEADER='' i18n=0 %)
Reply
HEADER yes.. super, i18n=0 does not work.
Reply
Try with showLanguage=0 instead.
Reply
(2013-03-07, 04:44:10)Carlos Wrote: Try with showLanguage=0 instead.

the documentation is correct i18n=0. Plugin i18n I have version 3.0.5, does not work to me.
Reply
Could anyone using i18n_search plugin along along with i18n plugin (more than one language) confirm, that on GS 3.2 after enabling fancy urls or using custom permalink structure, i18n_search won't show any results even using default search options ?

edit: same happens w/o using i18n with additional language

complete rework from scratch was required
Addons: blue business theme, Online Visitors, Notepad
Reply
Hi!
I've noticed that making a search with the plugin, if in the text it is present the character "à" ( &aagrave; ), the excerpt is not shown.
However, if the numWords is set on -1, the full text is displayed including the character "à".
I tried the same also with other characters like è, é, ù, etc. but they don't affect the search process, only the character "à" and only for the excerpt.
Perhaps it is a problem of translitteration or it happens to me only, I don't know.
Thanks for your hints
GPB
Reply
(2013-04-10, 01:57:43)GPB61 Wrote: Hi!
I've noticed that making a search with the plugin, if in the text it is present the character "à" ( &aagrave; ), the excerpt is not shown.
However, if the numWords is set on -1, the full text is displayed including the character "à".
I tried the same also with other characters like è, é, ù, etc. but they don't affect the search process, only the character "à" and only for the excerpt.
Perhaps it is a problem of translitteration or it happens to me only, I don't know.
Thanks for your hints
GPB

Just tested it (assuming you mean &agraveWink and it works for me. But you could experience problems if your site is not encoded in UTF-8, or your PHP was compiled without UTF-8 support.
I don't think that having support for multibyte strings or not should have an effect, but I'm not sure.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
Thanks for the answer.
Actually the encoding is correctly set (UTF-8), proof of it is that when extracting the full text it does not have problems and the text, and character, are correctly displayed.
The problem is with the excerpt. If in the source code I manually change "à" (ASCII code 133) to &aacute; (i.e. á - ASCII code 160), the excerpt is displayed again. I tried also with several other ASCII codes and the excerpt is always displayed. This is something that happens only when the character "à" is within the string of text belonging to the excerpt.
I also tried with several different servers (also Windows based ones) and always the excerpt does not show if it finds that character.
Well, it is not a big issue, it is enough to tell clients to use the acute accent rather than the grave one, but it was just to share knowledge about this strange behaviour (that perhaps it happens only to me...)
Reply
(2013-04-10, 21:14:43)GPB61 Wrote: Thanks for the answer.
Actually the encoding is correctly set (UTF-8), proof of it is that when extracting the full text it does not have problems and the text, and character, are correctly displayed.
The problem is with the excerpt. If in the source code I manually change "à" (ASCII code 133) to &aacute; (i.e. á - ASCII code 160), the excerpt is displayed again. I tried also with several other ASCII codes and the excerpt is always displayed. This is something that happens only when the character "à" is within the string of text belonging to the excerpt.

Of course speaking of ASCII codes when using UTF-8 is rather weird...
Can you attach or PM me a page file with à for tests, please.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
Hi, first I would to thank you for this awesome plugin.

Is it possible to create a RSS Feeds only for certain language?
I've read the docs but can't found the parameter to do that
Reply
(2013-04-10, 21:35:00)mvlcek Wrote: Of course speaking of ASCII codes when using UTF-8 is rather weird...
Can you attach or PM me a page file with à for tests, please.
I PMed a text file with the character and a couple of screenshots showing the problem.
Thanks for testing.
Reply
(2013-04-10, 23:37:25)whiteh0rs3 Wrote: Hi, first I would to thank you for this awesome plugin.

Is it possible to create a RSS Feeds only for certain language?
I've read the docs but can't found the parameter to do that

All parameters can be found in the administration under plugins/configure i18n search.
Just add e.g. lang:en (for english) to the (% searchrss ... %) call.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
OMG!! how come i miss that page, thank you mvlcek
Reply
I need to show the end of the article a list of similar items by tag, but
'order' => 'created', by creation date
'order' => 'date', by publication date
'order' => 'reverseurl', ascending url
'order' => 'url', url Descending
can you think of that either
'order' => 'random'???
Reply
Hi Oleg,

As a solution (until perhaps mvlcek decides to add this feature), this may suffice (it is adapted from a similar question posed on StackOverflow). Define this function somewhere on your template:

Code:
<?php
function random_i18n_search_results($tags=null, $words=null, $first=0, $max=10, $order=null, $lang=null) {
    $query = return_i18n_search_results($tags, $words, $first, $max, $order, $lang);
    
    if (!is_array($query)) return $query; // failsafe to still return a value if $query isn't an array
    $order = array_keys($query['results']); // gets keys of the query
    shuffle($order); // reshuffles the array
    $random = array(); // creates empty array to loop through
    foreach ($order as $result) {
        $random[] = $query['results'][$result]; // adds each result to the array
    }
  return $random; // returns results as an array with indices reordered
}
?>

Then to use it (e.g. in a component), fill in the appropriate parameters in the function to get your query and loop the results through a foreach (like below):

Code:
<?php
$results = random_i18n_search_results($tags='yourtags', $words='yourwords', $first=0, $max=10, $order='anyorder', $lang='anylang');

foreach ($results as $entry) {
    // whatever you wish to output, e.g. "echo $entry->slug;" to get the slugs - you'll need to style these outputs to get exactly what you want
}

?>

This will output your results in a random order on each page refresh.

Also mvlcek, can you please reupload your i18n_search_dummy.zip file? (Selfish of me perhaps, but I want to see if I can save some agony building a search function for MSGBoard by integrating i18n search in some way.)
Reply
(2013-04-21, 19:36:15)Angryboy Wrote: Also mvlcek, can you please reupload your i18n_search_dummy.zip file? (Selfish of me perhaps, but I want to see if I can save some agony building a search function for MSGBoard by integrating i18n search in some way.)

That's great! I would like to see all plugins like news manager or your board to support searching.
I uploaded the search dummy in the first post of this topic.
If you have any problems with the integration, send me a PM.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
Thanks mvlcek - I'm looking over the example now and finding out how best to integrate it. It should be possible, but might need a bit of ingenuity to be slick and efficient. Kudos again for making your plugin compatible and extendable to others.
Reply
Hello,mvlcek!
Thanks for plugin! Could you help me with it? There are problems when I do a search query in Russian-plugin for some reason is not looking. And the English words found. Also in the file that is used to store the indices do not fall Russian word.
Reply
Hello,mvlcek!

First of all, you did a great job, with all your plugins, I am really impressed.
I have one question:
Is your search plugin able to search words with some signs combinations in tags or words?
I noticed problems with search results while I am trying to put into search form combinations like that:
C#, C%, C%percent
And it finish with no result, when i cut 4 example % from the last word everything is fine.

I found regex function in your code, but to be honest i am not 100% sure if it dont get that signs.
PHP Code:
'/^(-?\d+)\s*([a-zA-Z]*)$/' 
In my honest opinion it recognize only signs a-z, A-Z, spaces, '-', and numbers. I dont see there anything about group of signs {!,@,#,$,%,^,&,*..}. Correct me if I am wrong.

Is there possibility to modify your r.extension to search word combination i mentioned upper? Of course I can try it myself, but the thing is that it might be usefull for others too.

I already tried some solution, but it works only in simulator, your function doesn't pass through it, so I've decided to ask.
Reply
(2013-05-03, 19:56:04)some1 Wrote: Is your search plugin able to search words with some signs combinations in tags or words?

No, it indexes groups of "word characters" (see indexer.class.php, addWords). You would need to change this to index words with signs.

(2013-05-03, 19:56:04)some1 Wrote:
PHP Code:
'/^(-?\d+)\s*([a-zA-Z]*)$/' 

This has nothing to do with the search, but just parses a excerpt length specification.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
(2013-05-03, 20:49:17)mvlcek Wrote:
(2013-05-03, 19:56:04)some1 Wrote:
PHP Code:
'/^(-?\d+)\s*([a-zA-Z]*)$/' 

This has nothing to do with the search, but just parses a excerpt length specification.
Thank you for fast reply.
yes, I noticed it when i changed that extension to something that shouldn't pass normal word.

Thanks for the tip, now i know the proper place, going into that code and trying to solve it.

Greets.

EDIT:
Oky I got it, it works for me fine, use it on your own risk. Maybe in new release mvlcek will put some option for it.

IMPORTANT if you are going to use it
I put so much time for it because there were testing problem with tags. I didn't know how that engine works, anyway if you have for example post with tag "C#" and you put a new function version, nothing gonna happened (u will not be able to search 'C#'). In order to take a new function functinallity into effect you need make new post or just edit some of the old one to reload "C#" tag.

File: i18n_search/indexer.class
Function:
PHP Code:
private function addWords($fullid$text$weight

Old fragment:
PHP Code:
if (self::$ismb) {
      
mb_ereg_search_init($text"\w+");
      if (
mb_ereg_search()) {
  
// [...] 
    
} else {
      
preg_match_all("/\w+/"$text$matches); 

New fragment
PHP Code:
if (self::$ismb) {
      
mb_ereg_search_init($text"([\w#]+)");
      if (
mb_ereg_search()) {
     
// [...] 
    
} else {
      
preg_match_all("/[\w#]+/"$text$matches); 


If some1 need more extra symbols just put it after \w and before ] like:
PHP Code:
[\w#%@] 

Greets

EDIT2:
Ok, first I didn't notice that, but i am also using tag_cloud.
To let tag cloud get tags in proper format "C#" not "C" you need also modify function:
PHP Code:
private function processTags() 

Here is old fragment:
PHP Code:
//[...]
if (self::$ismb) {
            
$tag mb_ereg_replace("[^\w]""_"mb_strtolower($tag'UTF-8'));
          } else {
            
$tag preg_replace("/[^\w]/""_"strtolower($tag));
//[...] 

And new one:
PHP Code:
//[...]
if (self::$ismb) {
            
$tag mb_ereg_replace("[^\w#]""_"mb_strtolower($tag'UTF-8'));
          } else {
            
$tag preg_replace("/[^\w#]/""_"strtolower($tag));
//[...] 

Greets
Reply




Users browsing this thread: 15 Guest(s)