Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Search plugin (I18N)
m1k3y Wrote:Unfortunately that doesnt work for me ,as I use Jquery Masonry, so the two <ul>s with the class "search results" break my layout and the elements don't get positioned the way i want it....

I recognized, that by default the last saved elements are at the top, and i wondered if i could rewrite this that certain categories are at the top and others not

If you use the function return_i18n_search_results, you can do anything with the results, but you have to loop through the entries yourself and display them.

I plan on adding a hook to specify a function for sorting/filtering the results before it is displayed in the next plugin version.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
mvlcek Wrote:I plan on adding a hook to specify a function for sorting/filtering the results before it is displayed in the next plugin version.

When do you plan to release it ? Im rather a phpnoob so i guess using the return function is to complicated for me.... anyway thanks for your time
Reply
Thank for such a great plugin! I'm using it with Special pages for making news page. But I have some troubles.
1. Can't set numWords to "1p" in Plugins setting section. I have to add this parameter in the News page (% searchresults numWords=1p %)
2. When I use numWords with actually a number (for exmple numWords=50) codepage breaks. Im my case it was russian "Р" letter. I had to change 44th string in searcher.class.php.
Code:
$excerpt = preg_split("/\s+/", $text, $length+1);
changed to
Code:
$excerpt = preg_split("/\s+/u", $text, $length+1);
information about u pattern modifier
I hope it will help.
3. I'm not sure this is right thread for this noob question, but problem appears only when i get search results. I have multilingual site with fancy_urls enabled. So my news page is example.com/news/date-of-news. But when i create news in second language i cant set parent page for it. That's ok until I want to get search results, because <?php get_special_field('link','',false); ?> returns link without "news" in the path. So it becomes example.com/date-of-news. Not a big deal but a bit annoying. How can get links with "news" in the path?
Thanks again and sorry for my bad "engrish" Smile
Reply
Sorry to bother you on this mvlcek, but how do you use the return_search_results() function properly to access the contents of the array? Just as an example:

Code:
$array = Array
(
    [totalCount] => 4
    [first] => 0
    [results] => Array
        (
            [0] => I18nSearchResultPage Object
                (
                    [data:protected] =>
                    [tags:protected] =>
                    [title:protected] =>
                    [content:protected] =>
                    [id:I18nSearchResultItem:private] => news-20120715-1617
                    [language:I18nSearchResultItem:private] => en
                    [creDate:I18nSearchResultItem:private] => 1342369067
                    [pubDate:I18nSearchResultItem:private] => 1342369067
                    [score:I18nSearchResultItem:private] => 1
                )

            [1] => I18nSearchResultPage Object
                (
                    [data:protected] =>
                    [tags:protected] =>
                    [title:protected] =>
                    [content:protected] =>
                    [id:I18nSearchResultItem:private] => news-20120710-0941
                    [language:I18nSearchResultItem:private] => en
                    [creDate:I18nSearchResultItem:private] => 1341913330
                    [pubDate:I18nSearchResultItem:private] => 1342365714
                    [score:I18nSearchResultItem:private] => 1
                )

            [2] => I18nSearchResultPage Object
                (
                    [data:protected] =>
                    [tags:protected] =>
                    [title:protected] =>
                    [content:protected] =>
                    [id:I18nSearchResultItem:private] => news-20120710-0835-1
                    [language:I18nSearchResultItem:private] => en
                    [creDate:I18nSearchResultItem:private] => 1341909328
                    [pubDate:I18nSearchResultItem:private] => 1342366336
                    [score:I18nSearchResultItem:private] => 1
                )

            [3] => I18nSearchResultPage Object
                (
                    [data:protected] =>
                    [tags:protected] =>
                    [title:protected] =>
                    [content:protected] =>
                    [id:I18nSearchResultItem:private] => news-20120710-0835
                    [language:I18nSearchResultItem:private] => en
                    [creDate:I18nSearchResultItem:private] => 1341909308
                    [pubDate:I18nSearchResultItem:private] => 1342365687
                    [score:I18nSearchResultItem:private] => 1
                )

        )

)
How would I access the contents of the page fields? I initially thought I could loop through the elements using a foreach function like so:

Code:
$results = $array['results'];
foreach ($results as $key => $field) {
    echo 'Field: '.$field['field_name'];
}

But this firstly doesn't print any results and secondly breaks the HTML that comes right afterwards (so the HTML of the page ends once it reaches the piece of code). What confuses me the most is the use of the I18nSearchResultPage Object () within the array. Is the use of the Object stopping me from accessing the elements of its array?

I'm asking this because I think I know how I can automate the archiving function that I worked on before (negating the need to put the '_archive' tag in posts), along with perhaps a 'display categories' function, but these can only be achieved if I can get the field information from returning the search results.
Reply
Angryboy Wrote:How would I access the contents of the page fields?

See the following example:
Code:
$array = return_search_results(...);
$results = $array['results'];
foreach ($results as $entry) {
    echo 'Field Content: '.$entry->content;
}
I also updated the description which still showed the information for an old version of the plugin.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
Thank you so much for that! (and for being so quick!) I'd been frustrated to no end by this, and your solution has provided the final component to the function I've written for archiving :-) I'm just testing it at the moment, but from the looks of it it will automatically output an archive list for your news entries without the need for the '_archive' tag (or any tags beyond the virtual _yyyy and _mm ones) that I focused on in the original tutorial.
Reply
Just wanted to share a suggestion, that search input field could contain a default text invoked inside (% searchform %) tag. Like: (% searchform text="enter your search phrase" live... %)
Website might contain more than one search form, and since you implemented awesome features based on javascript, cleaning the input field after focusing cursor would become an easy task.
Addons: blue business theme, Online Visitors, Notepad
Reply
yojoe Wrote:Just wanted to share a suggestion, that search input field could contain a default text invoked inside (% searchform %) tag. Like: (% searchform text="enter your search phrase" live... %)
Website might contain more than one search form, and since you implemented awesome features based on javascript, cleaning the input field after focusing cursor would become an easy task.
Personally, I'd prefer if he implemented it but only as far as using it for the placeholder HTML input attribute. The javascript in the search form at the moment I personally can't do anything with because I use yepnope via Modernizr.
Modern UI Admin for GetSimple
Watch the demo. Install this plugin. Use this CSS. Enjoy.
Reply
Martin: is there a way to get results of search through pages belonging to certain slug, using virtual _parent_slug tag, where slugs are nested in 3-4 level tree ?
Addons: blue business theme, Online Visitors, Notepad
Reply
Hello, thanks for this plugin.

I have a problem with it though...

On my local server it works perfectly, however on my internet server it doesn't.

Here's the link - http://www.foxlawyers.com/NEWSITE

Try doing a search and you'll see the problem.

Any help, much appreciated...
Reply
yojoe Wrote:Martin: is there a way to get results of search through pages belonging to certain slug, using virtual _parent_slug tag, where slugs are nested in 3-4 level tree ?

Not out-of-the-box - indexing only takes the information of the current page.
But of course you can write an addon ;-) that adds e.g. _ancestor_slug tags for all grandparents, etc.
See http://mvlcek.bplaced.net/i18nsearch/i18...-indexing/ - you can probably use the GS page caching functions to get the required information.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
jamesashcroft Wrote:Hello, thanks for this plugin.

I have a problem with it though...

On my local server it works perfectly, however on my internet server it doesn't.

Here's the link - http://www.foxlawyers.com/NEWSITE

Try doing a search and you'll see the problem.

Any help, much appreciated...

The only problem I see is that you are using HTML tags in your title. To correct the display of search results, use custom rendering and remove the htmlspecialchars() function around the title (maybe you have to use stripslashes() instead).
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
somehow in version of the GS 3.1.2 plugin refuses to seek Russian capital letter P and in search of her shows so �
Reply
Hello,

Is there a way to change the default ugly urls' to something more user and search engine friendly?

Quote:http://site.com/blog?tags=&words=&search=&page=4 (using with special pages)

to something like this
Quote:http://site.com/blog/page4

Have anyone did this in the past? rewrite rules anyone? Thanks.
Reply
One more thing. I'm trying to display the latest blog posts in the website's footer using the special pages plugin.

Code:
<?php get_i18n_search_results(array('tags'=>'_special_blog','component'=>'blog-entries-footer','max'=>4,'HEADER'=>' ')); ?>

Component
Code:
<div class="box s1">
                    <h4><a href="<?php echo $item->link; ?>"> <?php echo htmlspecialchars($item->title, ENT_NOQUOTES); ?></a></h4>
                </div>

and it does work but the plugin adds the default formatting that breaks everything up

Code:
<ul  class="search-results ">
  <li  class="search-entry ">
                <div class="box s1">
                    <h4><a href="http://site.com/blog/avoid-holiday-accidents"> Avoid Holiday Accidents</a></h4>
                </div>  </li>
</ul>

How I can remove the UL? Haven't found any param in the docs, additionally I'd like to add the entry count (1-4) to the class of a opening div

Code:
<div class="box sCOUNT">

Hope I'll get an answer. Thank you.
Reply
[/root.] Wrote:Hello,

Is there a way to change the default ugly urls' to something more user and search engine friendly?

Quote:http://site.com/blog?tags=&words=&search=&page=4 (using with special pages)

to something like this
Quote:http://site.com/blog/page4

Have anyone did this in the past? rewrite rules anyone? Thanks.

You cannot remove the search parameters, but if you install the Pagify plugin and add to gsconfig.php
Code:
define('PAGIFY_SEPARATOR','/page');
you might move the page parameter to the URL. Of course you also need to add appropriate rewrite rules.
BTW, google also has the page number (items to skip, start) as parameter in the URL.
Anyway, the only time a search engine might index your search result page is if you include a link like /search/?words=mysearchterm or similar in another page.

[/root.] Wrote:One more thing. I'm trying to display the latest blog posts in the website's footer using the special pages plugin.

I can remove the UL? Haven't found any param in the docs

Just add appropriate rules to your CSS that ul/li are not visible as such.

[/root.] Wrote:additionally I'd like to add the entry count (1-4) to the class of a opening div

You could add an additional search call (return_i18n_search_results, get words/tags from URL) and use the number of returned items (count($searchresults->results)) in the surrounding div.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
mvlcek Wrote:
[/root.] Wrote:additionally I'd like to add the entry count (1-4) to the class of a opening div

You could add an additional search call (return_i18n_search_results, get words/tags from URL) and use the number of returned items (count($searchresults->results)) in the surrounding div.

I do understand what you mean but I have not enough knowledge to accomplish this. Any chance you can post a complete code?

Code:
<div class="box sCOUNT">
                    <h4><a href="<?php echo $item->link; ?>"><?php echo htmlspecialchars($item->title, ENT_NOQUOTES); ?></a></h4>
                </div>

Thank you any way Smile
Reply
Greetings all. I am trying to get this to work with GS Blog 1.4.1, but am having no luck.
I am quite sure I am missing something obvious, because I can receive results from other pages, minus blog posts.

In my main template I have added
Code:
<?php get_i18n_search_form(array('slug'=>'search')); ?>

Created a page "Search" with
Code:
(% searchresults %)

In my "News" page I placed
Code:
(% searchresults tags:news numWords:-1 order:reverseurl %)

And added the tag "news" to blog posts.

I have gone through all 13 pages of this thread, but cant seem to figure it out.
Can anyone explain what I am not doing to be able to search Blog posts?


GS Community Edition with php8.x compatibility, new features and much more!  Support Me


Reply
I18N Search version 2.9:
  • adds the option to mark all search terms on result pages (even when coming from Google or Bing)
  • updates the polish and russian translations (thanks @yojoe and @Oleg06)

To use the search term marking
  • switch it on in the I18N Search settings
  • add a rule span.mark { background-color: yellow; } to your CSS
  • in your template replace <?php get_page_title(); ?> with <?php echo i18n_search_mark(return_page_title()); ?>
  • if you use the FAQ plugin, update to version 1.1 to automatically open relevant questions/answers.
As an example go to http://mvlcek.bplaced.net/search/, enter "search faq" and search, then click on the result Frequently Asked Questions (FAQ).
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
islander Wrote:Greetings all. I am trying to get this to work with GS Blog 1.4.1, but am having no luck.
I am quite sure I am missing something obvious, because I can receive results from other pages, minus blog posts.

I18N Search indexes all pages.
It also includes hooks for other plugin authors to index custom fields and non-page items like those of GS Blog. The details are described here. My own plugins (I18N Custom Fields, I18N Special Pages, I18N Gallery) implement these hooks and are thus fully searchable.

So you are doing nothing wrong, but the GS Blog items are not pages and the plugin author did not include the required functionality for I18N Search.

Ask the plugin author to implement I18N Search support or implement it yourself - if you know how the plugin's data is stored and you are familiar with PHP.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
mvlcek Wrote:Ask the plugin author to implement I18N Search support or implement it yourself - if you know how the plugin's data is stored and you are familiar with PHP.

Thanks for the feed back. Happy to know it wasn't me doing wrong.
I don't think that I am competent to implement this myself yet. I just assumed that this would be a common feature/request that would have been implement before. So for the mean time, I will just have to hold out until someone brainier that myself is willing to share their knowledge.


GS Community Edition with php8.x compatibility, new features and much more!  Support Me


Reply
Hey, I am trying to use the this plugin as kind of a offerslist, making a list with childnodes and displaying fields from specialpages. This works really good, but i get all languages pages in the list. Is there some way of seperating so i only get the pages from the current language i am on in the list?
Reply
Hi. mvlcek.
i am planning to use search plugin as news manager.
Is it possible to make read more button with search result?
How to display day of weeks and month in the search result in russian language?
Reply
mus.aqeel Wrote:Hi. mvlcek.
i am planning to use search plugin as news manager.
Is it possible to make read more button with search result?
How to display day of weeks and month in the search result in russian language?

To display a more button, use Custom Rendering.

To display the date in russian, make sure you are using the russian translations (either by using I18N or by adding $LANG='ru'; to gsconfig.php.
Then you can either change the russian language file ('DATE_FORMAT') or add a parameter DATE_FORMAT to the search result call, e.g.
Code:
(% searchresults DATE_FORMAT='<add the format>' %)
(see the PHP function strftime for information on the format)
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
I18N Search version 2.9.1:
  • fixes the bug that the configuration item "mark search terms" is initially shown as on instead of off.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply




Users browsing this thread: 11 Guest(s)