Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Search plugin (I18N)
I18N Search version 2.10:
  • now supports I18N special fancy URL placeholders like %parents%, etc.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
Hi Martin, tell me how to write the code correctly?
Code:
<?php get_i18n_search_results(array('addTags'=>'_parent_' + return_page_slug(),'words'=>' ','max'=>12,'numWords'=>50,'HEADER'=>null,'component'=>'renderproduct')); ?>
Reply
(2013-05-07, 08:10:29)Oleg06 Wrote: Hi Martin, tell me how to write the code correctly?
Code:
<?php get_i18n_search_results(array('addTags'=>'_parent_' + return_page_slug(),'words'=>' ','max'=>12,'numWords'=>50,'HEADER'=>null,'component'=>'renderproduct')); ?>

Code:
<?php get_i18n_search_results(array('tags'=>'_parent_'.return_page_slug(),'words'=>' ',
'max'=>12,'numWords'=>50,'HEADER'=>null,'component'=>'renderproduct')); ?>

In PHP you use . (dot) to combine strings. Use tags, unless the user enters tags himself and you want to add tags.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
Thank you very much, it works
Reply
hello, thank You very much for perfect work.
But i can't make the rss function work. I receive: Oops! Page not found!
My search tag: (% searchrss name:rss title:"RSS Feed" tags:yblog numWords:30 %)
GS 3.2.1
I18N Version 3.2.1
I18N Search 2.10
I18N Special Pages 1.1.3

Thanks
Reply
(2013-05-11, 11:04:42)SHUK91 Wrote: Hi !

I wanted to thanks the author of those amazing plugins ! Thanks Martin Wink

1) Also, is it possible to custom the "Search" button and the input area to make something more attractive ? and how ?
2) How can I modify the space between the "<h3 class="search-entry-title">" and the results ? because I have like 1 cm between The result title and the content.
3) And how can I add a space between the content and the next Result title ?

You can add appropriate styles to your CSS file, e.g.
Code:
form.search .search-submit { color: red; }
.search-result li.search-entry { margin-bottom: 20px; }

(2013-05-11, 11:04:42)SHUK91 Wrote: 4) Finally, can I remove a search entry by adding a param to the search_display form ? e.g. I have some pages with the param (% gallery %) because I'm using I18N gallery. And in the result page, it shows the (% gallery %) at first and that is confusing for the user.

The newest version 2.10.1 removes these placeholders.

I18N Search version 2.10.1:
  • removes placeholders (% ... %) and {% ... %} from excerpts (@SHUK91).
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
Hello,

I'd like to request the addition of a 'menu order' sort for search results.

I have a site with a catalogue of products. Each product has its own page, built on a I18N Special Pages template.

I have a catalogue 'overview' page, where the page contents is generated by
Code:
(% searchresults tags=_prodcat max=6 numWords=1p order:url showPaging=1 HEADER="" %)

In order to have the product preview (numWords=1p) shown in the same order as the menu listing (from lowest-specification to highest-specification, for example), it is necessary to craft the slug of each page to make sure that (order:url) gives me the required result. I do this by manually prefixing a number to the automatically generated slug.

Two disadvantages to this approach:
  • manual adjustment is necessary when adding a new product page or changing the order
  • the sort-order prefix is visible in the page URL, which can be unsightly
In other use cases, it would allow a simple method of manually forcing a search display order, simply by changing the menu order (drag & drop in the Page Options). Even if the page is subsequently removed from the menu (by clearing the 'Add this page to the menu' box), the sort order would remain.

Would this be doable, please?
--
Nick.
Reply
I18N Search version 2.11:
  • Supports ordering the search result by any (custom) field, use order:+field or order:-field, where field is the element name in the page's xml file (@hameau)

E.g. order:+menuOrder will sort the results like in the menu. This works only, if all search results have the same parent page, otherwise the sorting is unpredictable.

E.g. order:+title will sort the results by title. This will probably only work correctly for english titles.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
Fantastic, thank you very much! (I wish I had asked a couple of months ago!)
--
Nick.
Reply
(2013-05-13, 04:48:04)hameau Wrote: Fantastic, thank you very much! (I wish I had asked a couple of months ago!)

Somebody asked some months ago and I started implementing it. Your post reminded me on finishing it ;-)
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
I think somebody was me. ;-) (at least for the order of titles)

Congratulations for adding this useful option. It makes this plugin even more powerful.

I suppose it should -more or less- work fine for, besides English, other languages that don't use too many non US-ASCII chars (Italian, German, Spanish...)
Reply
Thank You MrVlcek, Great Job again!
Reply
(2013-05-13, 15:48:02)Carlos Wrote: I think somebody was me. ;-) (at least for the order of titles)

Congratulations for adding this useful option. It makes this plugin even more powerful.

I suppose it should -more or less- work fine for, besides English, other languages that don't use too many non US-ASCII chars (Italian, German, Spanish...)

How long ago did you ask? I actually made a suggestion for menu ordering last March (time's really flown by xD)

Can't wait to test this out. Does this mean that any sorting can be done even for other plugins that use I18N Search? (today I've finally got the search feature fully working for the forum plugin (which has been rewritten from the ground up), and this could certainly help with the sorting of the results by)

As always, splendid job and thanks for constantly being here to provide rapid response to inquiries and diligent support for your plugins.
Reply
(2013-05-14, 06:56:37)Angryboy Wrote: How long ago did you ask?

Feb '12. Not really asked for (I didn't need it), it was just a suggestion because I thought it would be useful.
Reply
(2013-05-14, 07:31:34)Carlos Wrote:
(2013-05-14, 06:56:37)Angryboy Wrote: How long ago did you ask?

Feb '12. Not really asked for (I didn't need it), it was just a suggestion because I thought it would be useful.

Goodness. I'll say it again, time has flown XD (and your suggestion was very useful indeed :-))

Just tested this and it seems to work for regular pages. With my forum script, DM_Matrix seems to have a bit of trouble sorting by anything other than pubDate and times out (I likely have too many queries running during the search). In principle though, I think it does work for other items indexed by i18n search; I'll just need to find another way of resorting the arrays.

Next possible suggestion(s) to this ever-growing search module when the time exists:

Excluding tags - example:
Code:
(% search noTags='tag1, tag2' %)

Then that removes all entries in the search that have the tags 'tag1' and 'tag2' (probably involves using in_array() and iterating through the search items to remove entries that meet that condition).

OR detection - example
Code:
(% search tags='tag1 OR tag2' %)
Does a query for tag1, another for tag 2 and merges the queries/arrays, so you have either one searched for.

*edit*

Found out my problem (really stupid mistake on my part that unnecessarily made the query loading ridiculously long). Yup, custom sorting works for all items indexed by i18n search, even other plugins.
Reply
Is there a way that only those pages are listed in the search results that are shown in the menu?

Alex
Reply
(2013-05-24, 19:25:57)Alexander_ Wrote: Is there a way that only those pages are listed in the search results that are shown in the menu?

You can add the following to the function i18n_search_index_page in i18n_search.php:
Code:
$menu = @$item->menuStatus;
if ($menu == 'Y') $item->addTags('menuStatus', array('_menu'));
Then add addTags=_menu to your (% searchform ... %) and (% searchresults ... %) and save any page to trigger a re-indexing.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
(2013-05-25, 01:53:22)mvlcek Wrote: You can add the following to the function i18n_search_index_page in i18n_search.php:
Code:
$menu = @$item->menuStatus;
if ($menu == 'Y') $item->addTags('menuStatus', array('_menu'));
Then add addTags=_menu to your (% searchform ... %) and (% searchresults ... %) and save any page to trigger a re-indexing.

Works fine - thx!

Alex
Reply
Sorry to nag you here too but I wanted to change the bottom padding for the news search result li. But it didn't work, so I looked into the source of my rendered news site and found this:
Code:
<ul  class="search-results ">
<li  class="search-entry ">
The additonal white spaces before class are not doing any harm but the white spaces at the end of the class entries are clearly not intended because they prevent setting any css value for this classes.
Reply
You can alter the padding purely with CSS (using the important flag) or use Javascript/Jquery to add extra classes to the results. I'd go with the former.
Code:
.search-entry { padding: 0 !important; }
Reply
Tanks for the tip, works great but I still think the white spaces are unintentional.

And one question for the max: value in the news search. It limits the number of entries to be shown on a site and the page selection is still shown. Is it possible to suppress the page selection and show only a couple of entries? It's really convenient to use the I18N Search plugin to get the news collected for my site and if suppressing of the page selection were possible it would be perfect.
Reply
Set showPaging to 0.
Reply
(2013-06-26, 23:08:21)Angryboy Wrote: Set showPaging to 0.
Wow, thanks a lot. It's so simple if you know how to do it. Smile
Reply
I've tested to set a page with the tag news to private, it's still be found by the search for news tag.

I know that this is a bit complicate because if you search for something you usually want to find anything that matches the search but if a page is set to private it's contents should not be visible from outside.

So I'm not sure if it is the correct way of handling things if private pages are included/excluded in the search result. If you include it you may open a path to exposing something that you wanted to keep secret.
Reply
(2013-07-04, 23:59:00)ds10 Wrote: I've tested to set a page with the tag news to private, it's still be found by the search for news tag.

Setting the visibility of a page to private and saving it will delete the search index. It will be recreated without this page whenever you do the next search. Thus this private page will not be found.
There might be steps like undo saves or similar where the search index is not recreated and thus the now private page is not removed from the index.

I.e.: it works for me and it should work for you, too. You can also try manually removeing /data/other/i18n_*_index.txt
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply




Users browsing this thread: 15 Guest(s)