Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Search plugin (I18N)
diem Wrote:Hey there, quick question. Is there a way to exclude pages from the search so that they don't show up?

Quick answer: yes.
Longer answer: you have to write a plugin which registers a filter for 'search-veto', for more information see top of i18n_search.php.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
I suppose you are referring to these lines of code:

Code:
# filter search results (vetoed items are removed from results)
#  - parameters: $item (of type I18nSearchResultItem or I18nSearchResultPage)
#  - must return true, if item should not be included in search results
define('I18N_FILTER_VETO_SEARCH_ITEM', 'search-veto');

As I am no PHP literate, I would greatly appreciate it if you could provide some more info regarding excluding specific pages. Thanks in advance and sorry for the trouble...
Reply
diem Wrote:I suppose you are referring to these lines of code:

Code:
# filter search results (vetoed items are removed from results)
#  - parameters: $item (of type I18nSearchResultItem or I18nSearchResultPage)
#  - must return true, if item should not be included in search results
define('I18N_FILTER_VETO_SEARCH_ITEM', 'search-veto');

As I am no PHP literate, I would greatly appreciate it if you could provide some more info regarding excluding specific pages. Thanks in advance and sorry for the trouble...

Currently there is no way doing it without PHP. You have to create a plugin as described in the Wiki, add a filter with the name 'search-veto' and implement your filter function based on the information you get from the parameter of class I18nSearchResultItem (see /plugins/i18n_search/searcher.class.php).
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
on the pages are tagged with code gallery
Code:
<div class="gallery gallery-prettyphoto gallery-bottom-gallery-/-/">

      <div style="clear:both"></div>
    </div>
    <script type="text/javascript" charset="utf-8">
      $(document).ready(function(){
        var $sel = $("a[rel='prettyPhoto[bottom-gallery-/-/]']");
                $sel.prettyPhoto({
theme: "dark_rounded",           social_tools: false
        });
    });
    </script>
Gallery is not visible
in footer
http://u-la-la.ru/tager.html?tags=%D1%81...1%8C%D1%8F
Reply
Oleg06 Wrote:on the pages are tagged with code gallery
Code:
<div class="gallery gallery-prettyphoto gallery-bottom-gallery-/-/">

      <div style="clear:both"></div>
    </div>
    <script type="text/javascript" charset="utf-8">
      $(document).ready(function(){
        var $sel = $("a[rel='prettyPhoto[bottom-gallery-/-/]']");
                $sel.prettyPhoto({
theme: "dark_rounded",           social_tools: false
        });
    });
    </script>
Gallery is not visible
in footer
http://u-la-la.ru/tager.html?tags=%D1%81...1%8C%D1%8F

The problem is that the HTTP parameter tags is used by I18N Search and by I18N Gallery: if the parameter is given, I18N Gallery will only show the images tagged with this tag(s). I suppose, I should rename the parameter for I18N Gallery...
(Initially I18N Gallery was not intended to be included in template instead of in page content)

Quick fix: remove the line with $_GET['tags'] in i18n_gallery.php, function i18n_gallery_get_from_params.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
thanks, helped Smile
Reply
For some reason, this piece of code:

Code:
<?php echo strftime($dateFormat, $item->creDate); ?>

Doesn't echo anything. The variable $dateFormat doesn't do anything for me. But when I changed it to:

Code:
<?php echo strftime("%d-%m-%Y", $item->creDate); ?>

I was able to output the date how I wanted it to. So perhaps it might be a good idea to tell users about changing the format of the date (especially for those where that variable appears to be blank).

-----

[Sidenote: I've finished the article about your 2.X.X incarnation of this plugin as a News module]
Reply
The documentation says it can be styled with CSS - but other than a jquery css file, there is no other css in the plugin. Do I have to search for every instance of "class=" and add it to my css file?
Reply
charles_i Wrote:The documentation says it can be styled with CSS - but other than a jquery css file, there is no other css in the plugin. Do I have to search for every instance of "class=" and add it to my css file?

Just output the search form and search results (e.g. here) and look at the generated code, e.g.
Code:
<form class="search" ...>
...
<h2 class="search-header">...
<ul class="search-results">
  <li class="search-entry">
...
Then make appropriate rules in your CSS for the parts that you want to style (differently).
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
I have the search plugin functioning in a news / blog capacity. It works great however, I don't understand how to expand the use of tags to create basic categories and can't find any examples.

Let's say I have 4 tags - red, green, blue, and yellow. Yellow is my default tag that will be added to every news page.

On my main news page I want it to display all of the yellow tags in order of creation. I understand how to accomplish this. Where I need help is setting up a sidebar area with the red, green, and blue tags. When you click one of sidebar tags, it should only show that type of tag.

How would you create the on page component / search / call for this scenario?

Thanks!
Reply
m1super90 Wrote:I have the search plugin functioning in a news / blog capacity. It works great however, I don't understand how to expand the use of tags to create basic categories and can't find any examples.

Let's say I have 4 tags - red, green, blue, and yellow. Yellow is my default tag that will be added to every news page.

On my main news page I want it to display all of the yellow tags in order of creation. I understand how to accomplish this. Where I need help is setting up a sidebar area with the red, green, and blue tags. When you click one of sidebar tags, it should only show that type of tag.

How would you create the on page component / search / call for this scenario?

Thanks!

The easiest way would be to create 4 pages, with (% searchresults tags=yellow %), etc, where the yellow page is the index page, and create 4 links in the side bar.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
why when you install the code in the sidebar on the news page in the sidebar there is a bug
Code:
Fatal error: Cannot redeclare i18n_search_display_with_component() (previously declared in D:\home\0getsimple.ru\www\plugins\i18n_search\searchresults.php:142) in D:\home\0getsimple.ru\www\plugins\i18n_search\searchresults.php on line 144
Reply
Oleg06 Wrote:why when you install the code in the sidebar on the news page in the sidebar there is a bug
Code:
Fatal error: Cannot redeclare i18n_search_display_with_component() (previously declared in D:\home\0getsimple.ru\www\plugins\i18n_search\searchresults.php:142) in D:\home\0getsimple.ru\www\plugins\i18n_search\searchresults.php on line 144

This happens, if you display two search results, one on the page and one in the sidebar. I didn't think about this and will correct it.

Please surround the function by a condition like this:
Code:
if (!function_exists('i18n_search_display_with_component')) {
  function i18n_search_display_with_component($item, $component) {
    eval("?>" . $component . "<?php ");
  }
}
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
thanks, works
Reply
I18N Search version 2.3.3:
  • danish language (thanks to chrsand)
  • solved bug, if multiple search results are shown on the same page
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
tags for some reason, again without links
Reply
I've got a question:
Is it possible to use transliteration in this plugin? If yes, then how?
Reply
CyberDe@th Wrote:I've got a question:
Is it possible to use transliteration in this plugin? If yes, then how?

I don't understand. What do you mean?
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
For example:
I would like to type a word "slowo" in I18N Search to look for: "słowo" ("ł" to "l" conversion (transliteration) in index). Of course I also would like to find "słowo" by just typing it
Reply
I've got everything working as far as the Search pluging goes, but run into problems when trying the custom redering described here : http://mvlcek.bplaced.net/i18nsearch/i18...rendering/

On my news page I have the following :
Code:
(% searchresults tags=news component=newsdisp HEADER="News" %)

For sake of testing I've just created a simple component named newsdisp with the following :
Code:
<?php echo "Hello world!"; ?>

But it just stops rendering the page when it comes that far :
Code:
<div class="clear"></div>
                <div id="left">
                    <div class="breadcrumbs">
                      <a href="http://localhost/boozer/">Index</a>
                       &raquo; <span class="breadcrumb"><a href="http://localhost/boozer/" title="Home">Home</a></span></div>
                      <h2 class="search-header">News</h2>
<ul class="search-results">
  <li class="search-entry">

Weird thing is I have error reporting turned on in php.ini but no errors are displayed, it just stops rendering the page at that point.

Any ideas what I've done wrong?
Reply
I18N Search version 2.3.4:
  • Solves a bug when displaying a result list with component=mycomp (@Boozer)
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
That was fast! Thank you very much, works like a charm now.
Reply
Hi,
I am currently writing a plugin, based on your dummy, that allows News Manager posts to be added to the search index.

Can't believe I am the first to do so, but I can't find one out there. I know I could do news with tags,
but I don't want my client to bother with tagging.

Anyway... it works as expected, except the content field is not being indexed, which leaves me kind of puzzled, as I don't see a difference to the title field, which gets indexed as it should.
I realize News Manager is not your plugin, but maybe something catches your eye...
Here's the plugin code as it stands:
http://pastebin.com/jpmmxGEK

and here's an xml, as news manager created it.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<item>
<title><![CDATA[Testnews]]></title>
<date><![CDATA[Tue, 07 Feb 2012 16:49:45 +0100]]></date>
<tags><![CDATA[]]></tags>
<private><![CDATA[]]></private>
<content><![CDATA[&lt;p&gt;
    Dies ist ein Newsbeitrag.&lt;/p&gt;
]]></content>
</item>

thanks for your plugins!

on second thought... might it be the html entities that throw your indexer off?
Reply
geroyche Wrote:on second thought... might it be the html entities that throw your indexer off?

That's exactly what you need to take care off. As the Search plugin can't determine if this should be indexed as text which incidentally includes < and > or HTML, you have to make sure that the resulting text is pure text with no tags and HTML entities.

For HTML e.g. use:
Code:
html_entity_decode(strip_tags($content), ENT_QUOTES, 'UTF-8');
Depending on how the content is stored, you might even have to use something like:
Code:
html_entity_decode(strip_tags(htmlspecialchars_decode(stripslashes($content))), ENT_QUOTES, 'UTF-8');
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
Thanks for the quick reply.
Sometimes sleep helps. I did some debugging and I realized that the problem lay elsewhere.
The news manager function i used to fetch posts did not even include the content (it fetched everything else from a sort of "cache" News Manager creates).

Everything works now as it should.
I have one more question though: somehow your index is created everytime a regular page is being saved/updated.
The News Manager items are managed separately.
I reckon I might have to patch its code to trigger an index update.
How do I trigger it?

FYI: here are the functions as they need be for News Manager. Don't know if you want to include them in your plugin, though I figure I should probably give them to the NM dev instead.
http://pastebin.com/eqXS6XAR

I would upload the plugin for the general public, except that when I store it as a separate php file in my plugin folder, I cannot login anymore. I get stuck in a redirect loop.
I already had another custom plugin, and when I just include the functions in that one, everything works,
Reply




Users browsing this thread: 9 Guest(s)