GetSimple Support Forum
Search plugin (I18N) - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Plugins (http://get-simple.info/forums/forumdisplay.php?fid=13)
+--- Thread: Search plugin (I18N) (/showthread.php?tid=1256)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29


Search plugin (I18N) - mvlcek - 2012-06-06

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.


Search plugin (I18N) - m1k3y - 2012-06-07

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


Search plugin (I18N) - jsmith - 2012-07-01

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


Search plugin (I18N) - Angryboy - 2012-07-18

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.


Search plugin (I18N) - mvlcek - 2012-07-18

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.


Search plugin (I18N) - Angryboy - 2012-07-19

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.


Search plugin (I18N) - yojoe - 2012-08-24

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.


Search plugin (I18N) - sal - 2012-08-24

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.


Search plugin (I18N) - yojoe - 2012-09-07

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 ?


Search plugin (I18N) - jamesashcroft - 2012-09-11

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...


Search plugin (I18N) - mvlcek - 2012-09-16

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/i18n-search-custom-indexing/ - you can probably use the GS page caching functions to get the required information.


Search plugin (I18N) - mvlcek - 2012-09-16

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).


Search plugin (I18N) - Oleg06 - 2012-09-17

somehow in version of the GS 3.1.2 plugin refuses to seek Russian capital letter P and in search of her shows so �


Search plugin (I18N) - [/root.] - 2012-09-20

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.


Search plugin (I18N) - [/root.] - 2012-09-20

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.


Search plugin (I18N) - mvlcek - 2012-09-20

[/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.


Search plugin (I18N) - [/root.] - 2012-09-21

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


Search plugin (I18N) - islander - 2012-09-30

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?


Search plugin (I18N) - mvlcek - 2012-09-30

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).


Search plugin (I18N) - mvlcek - 2012-09-30

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.


Search plugin (I18N) - islander - 2012-09-30

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.


Search plugin (I18N) - linden - 2012-10-04

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?


Search plugin (I18N) - mus.aqeel - 2012-10-05

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?


Search plugin (I18N) - mvlcek - 2012-10-05

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)


Search plugin (I18N) - mvlcek - 2012-10-05

I18N Search version 2.9.1:
  • fixes the bug that the configuration item "mark search terms" is initially shown as on instead of off.