#1 2013-06-05 12:36:06

Kink
Ion Tester
From: France
Registered: 2010-06-04
Posts: 581

[howto] Installing Module Search for Ionize > 1.0.2

Because of changes of the new release of Ionize, Module Search does not work. So, i made in 5 minutes a non-official crappy search module for you. (based on the official search module for older version of Ionize)
I tested search module with Foundation theme and Ionize 1.02.

Ok, let's go.

First of all, dowload zip package from github : https://github.com/Kink03/ionize-module-search

1 - Copy the folder "Search" into the "/modules" folder of your Ionize installation.
2 - In the ionize backend, go to : Modules > Administration
3 - Click on "install"
4 - Create a view containing the tag <ion:search:display />
5 - Create a page called 'search', it's MANDATORY
6 - Translate title and url of this page to other languages
7 - Add previous view to this page.

To display a search form in other views, simply use the tag <ion:search:form />

Hope this howto will help

Last edited by Kink (2013-08-07 09:30:14)


Webmaster / OUF!WEB

Offline

#2 2013-06-05 15:22:58

minileaf
Member
Registered: 2013-05-18
Posts: 16

Re: [howto] Installing Module Search for Ionize > 1.0.2

it's works Kink, thanks a lot, but you may forgot to include config.xml in folder module. thanks again

Offline

#3 2013-06-05 15:26:23

Kink
Ion Tester
From: France
Registered: 2010-06-04
Posts: 581

Re: [howto] Installing Module Search for Ionize > 1.0.2

minileaf wrote:

it's works Kink, thanks a lot, but you may forgot to include config.xml in folder module. thanks again

No Minileaf, 'config.xml' is embedded in config file. But, there is a 'database.xml' instead.


Webmaster / OUF!WEB

Offline

#4 2013-06-05 15:40:35

minileaf
Member
Registered: 2013-05-18
Posts: 16

Re: [howto] Installing Module Search for Ionize > 1.0.2

Oh, ok then. Thanks for your help. Dee

Offline

#5 2013-06-10 12:49:21

Kink
Ion Tester
From: France
Registered: 2010-06-04
Posts: 581

Re: [howto] Installing Module Search for Ionize > 1.0.2

Like @minileaf said, search module displays duplicate results.
My idea is to deduplicate the array of results by filtering the ID of the article. Even there is one or more word in the article, the result must display only one entity of the article.

In /Modules/Search/libraries/tags.php

Find the loop :

foreach($articles as $key => &$article)

Old loop :

if ( ! empty($articles))
				{
					// arrays of keys, for multisorting
					$knum = $kdate = array();
					
					foreach($articles as $key => &$article)
					{
						// set number of found words
							preg_match_all('#'.$realm.'#i', $article['title'].' '.$article['content'], $match);
							$num = count($match[0]);

							$article['nb_words'] = $knum[$key] = $num;
							$kdate[$key] = strtotime($article['date']);						
					}

					// Sort the results by realm occurences DESC first, by date DESC second.
					array_multisort($knum, SORT_DESC, SORT_NUMERIC, $kdate, SORT_DESC, SORT_NUMERIC, $articles);
				}

Replace by this loop :

if ( ! empty($articles))
				{
					// arrays of keys, for multisorting
					$knum = $kdate = array();
					$unique = array();

					foreach($articles as $key => &$article)
					{
						//deduplicate
						if(!in_array($article['id_article'], $unique)) {
							$unique[] = $article['id_article'];
						
							// set number of found words
							preg_match_all('#'.$realm.'#i', $article['title'].' '.$article['content'], $match);
							$num = count($match[0]);

							$article['nb_words'] = $knum[$key] = $num;
							$kdate[$key] = strtotime($article['date']);
						
						} else {
							unset($articles[$key]);
						}
						
					}

					// Sort the results by realm occurences DESC first, by date DESC second.
					array_multisort($knum, SORT_DESC, SORT_NUMERIC, $kdate, SORT_DESC, SORT_NUMERIC, $articles);
				}

Is it a good trick ?


Webmaster / OUF!WEB

Offline

#6 2013-06-11 06:09:54

minileaf
Member
Registered: 2013-05-18
Posts: 16

Re: [howto] Installing Module Search for Ionize > 1.0.2

Yes Kink it's awesome, thanks again.

Offline

#7 2013-07-31 09:17:26

xiehao
Member
From: xml
Registered: 2011-11-04
Posts: 18

Re: [howto] Installing Module Search for Ionize > 1.0.2

Why    “ Tag missing: search, scope: . ”

Offline

#8 2013-08-08 01:59:43

mbarria
Member
Registered: 2013-07-02
Posts: 4

Re: [howto] Installing Module Search for Ionize > 1.0.2

I get

Tag missing: search, scope: .

Offline

#9 2013-08-08 10:26:31

Kink
Ion Tester
From: France
Registered: 2010-06-04
Posts: 581

Re: [howto] Installing Module Search for Ionize > 1.0.2

Ok, i found the silly bug :

You must change the name of the file 'tags.php' in Seach/libraries by :

search_tags.php

Webmaster / OUF!WEB

Offline

#10 2013-09-04 11:39:01

wal_toor
Member
From: The Netherlands
Registered: 2013-07-25
Posts: 17

Re: [howto] Installing Module Search for Ionize > 1.0.2

Hi all,

Just installed this search module in version 1.0.4 and getting the error "Tag missing: search, scope: ." I have checked all the comments above. But still getting this error. Anyone who found a solution?

greetz
walter

Offline

#11 2013-09-04 11:46:36

Kink
Ion Tester
From: France
Registered: 2010-06-04
Posts: 581

Re: [howto] Installing Module Search for Ionize > 1.0.2

From the last release on github https://github.com/Kink03/ionize-module-search ?


Webmaster / OUF!WEB

Offline

#12 2013-09-04 11:55:23

wal_toor
Member
From: The Netherlands
Registered: 2013-07-25
Posts: 17

Re: [howto] Installing Module Search for Ionize > 1.0.2

@ion tester,

Yes, downloaded it 30 min's ago.

Offline

#13 2013-09-04 12:11:10

Kink
Ion Tester
From: France
Registered: 2010-06-04
Posts: 581

Re: [howto] Installing Module Search for Ionize > 1.0.2

Well, i tested yet with fresh install and it's ok for me.
Tested with Ionize 1.04 and Foundation theme.

- I created a view named "search.php" with the only tag "<ion:search:display />
- I declared this view as "Search page" in the theme panel
- In System menu, i added a page called "search" and added the view "search page"
- I added this short code in the view "page_blog.php" at line 72 :

<div>
      <h3>Search</h3>
      <ion:search:form />
</div>

That's all.

When displaying "Blog", you will see the serch form. Now you can test a term to seach.


Webmaster / OUF!WEB

Offline

#14 2013-09-04 12:25:52

wal_toor
Member
From: The Netherlands
Registered: 2013-07-25
Posts: 17

Re: [howto] Installing Module Search for Ionize > 1.0.2

Thanks Ion,

but, grr.. still getting a Tag missing: search, scope: page:articles:article.

What could it be?

greetz,
walter

Offline

#15 2013-09-04 13:27:55

Kink
Ion Tester
From: France
Registered: 2010-06-04
Posts: 581

Re: [howto] Installing Module Search for Ionize > 1.0.2

@Member, my name is Kink tongue
Seriously, Wal_toor, could you PM me with your admin code, perhaps i can help you on your system ?


Webmaster / OUF!WEB

Offline

#16 2013-09-04 14:49:40

wal_toor
Member
From: The Netherlands
Registered: 2013-07-25
Posts: 17

Re: [howto] Installing Module Search for Ionize > 1.0.2

Hi Kink,

Sorry, thougt 'ion tester' was your name. ;-) Anyway, I have locally installed a clean version and added the search module. It works, so there must be something wrong with our templates. I'll just compare the default templates with mine.

Thans a lot for your time.

greetz,
walter

Offline

#17 2013-09-04 14:58:40

Kink
Ion Tester
From: France
Registered: 2010-06-04
Posts: 581

Re: [howto] Installing Module Search for Ionize > 1.0.2

A way to resolve your problem :
The search tag must not be in a <ion:page:articles> context


Webmaster / OUF!WEB

Offline

#18 2013-09-04 15:21:07

wal_toor
Member
From: The Netherlands
Registered: 2013-07-25
Posts: 17

Re: [howto] Installing Module Search for Ionize > 1.0.2

Aaait, and it works... There were some template issues there...

Thanks again, kink, for your help, really appriciate it.

Offline

#19 2013-09-04 15:45:11

wal_toor
Member
From: The Netherlands
Registered: 2013-07-25
Posts: 17

Re: [howto] Installing Module Search for Ionize > 1.0.2

Hi Kink, are you still there?

Have another question. I would like to change the layout of the search result. I found this code (old search module from this topic)

<ion:search>
	<h2><ion:page:title suffix="lang('for')" />"<ion:realm />"</h2>  

	<ion:results >       
		<ion:count is="true">
			<ion:result>
			<ion:title tag="h3" />
			<ion:content words="50" />
			<a href="<ion:url />" class="readmore"><ion:lang key="read_complete_article" /></a>
			</ion:result>
		</ion:count>

		<ion:count is="false">
			<p><ion:lang key="module_search_message_no_results" /></p>
		</ion:count>

	</ion:results>
</ion:search>

But this snippet only lets me see one result.

Do you have a solution for this?

greetz,
walter

Offline

#20 2013-09-04 15:56:07

wal_toor
Member
From: The Netherlands
Registered: 2013-07-25
Posts: 17

Re: [howto] Installing Module Search for Ionize > 1.0.2

Found it..

Changed the result loop to:

<ion:results:result>
<div>
	<ion:title tag="h3" />
	<ion:content words="50" />
	<a href="<ion:url />" class="readmore"><ion:lang key="read_complete_article" /></a>
</div>
</ion:results:result>

greetz,
walter

Offline

#21 2013-09-04 19:57:28

Michel-Ange
Ionize Core Team
From: Paris, France
Registered: 2010-03-22
Posts: 927
Website

Re: [howto] Installing Module Search for Ionize > 1.0.2

Thanks a lot Kink ! smile


Inspiration & Innovation : Websites by Partikule, Agence Web Paris

Offline

#22 2013-09-05 10:48:17

Kink
Ion Tester
From: France
Registered: 2010-06-04
Posts: 581

Re: [howto] Installing Module Search for Ionize > 1.0.2

Hey, Michel-Ange, i sent you a pull request on github about search module... no ? tongue tongue


Webmaster / OUF!WEB

Offline

#23 2013-12-20 17:29:41

zoom
Member
Registered: 2013-12-16
Posts: 3

Re: [howto] Installing Module Search for Ionize > 1.0.2

I was able to install the search module in ionize 1.0.4 but I've noticed it doesn't support pagination, can this be added? How can be done?

Thanks.

Offline

#24 2017-05-31 02:46:20

damascus
Member
From: Brisbane, Australia
Registered: 2013-04-08
Posts: 270
Website

Re: [howto] Installing Module Search for Ionize > 1.0.2

Im also interested in pagination, posted in http://ionizecms.com/forum/viewtopic.php?id=1085


Webmaster | OneCNC Australia

Offline

What's Ionize ?

Ionize is an Open Source Content Management System created by webdesigners for webdesigners.

Created and maintained by Partikule and Toopixel, Ionize wants to be the easiest and most powerful CMS.

Can I help ?

Because talent is nothing without involvement, we are looking for motivated coders and webdesigners to join the project team.

Resources

Website : ionizecms.com
Documentation : doc.ionizecms.com

Development : Ionize on GitHub
Translations : Ionize Translations