Welcome,
Guest
.
Please
login
or
register
.
Did you miss your
activation email
?
News:
IOS Hotels
and
IOS Rentals
online booking systems for Elxis CMS.
Home
Help
Login
Register
Elxis CMS Forum
»
Support
»
Elxis 4.x/5.x DEV
»
second search engine?
« previous
next »
Print
Pages: [
1
]
2
Author
Topic: second search engine? (Read 13328 times)
seadhna
Hero Member
Posts: 507
second search engine?
«
on:
June 06, 2014, 01:44:17 »
Hi there,
is it possible to have a second search engine that is set to search only one category?
A user can select which category to search manually but in a particular category I would like to have a search engine that is already pre-set to search only that category. If I copy the search module and have the copy appear on only the category in question, this works - but it still searches the entire site by default. I have played around with Mikro and Mikro search to see if this would work but it does not address this need unfortunately. Grateful for any suggestions!
Logged
datahell
Elxis Team
Hero Member
Posts: 10356
Re: second search engine?
«
Reply #1 on:
June 06, 2014, 09:00:03 »
Search engines are extensions like modules. You can develop your own engine or modify an existing one to work as you want. If you want to search only within a specific category hide the categories drop down list and insert a hidden field with the value of the category you want only to search into.
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
seadhna
Hero Member
Posts: 507
Re: second search engine?
«
Reply #2 on:
June 06, 2014, 19:23:22 »
Of course! Works like a charm - thanks!
Logged
seadhna
Hero Member
Posts: 507
Re: second search engine?
«
Reply #3 on:
June 22, 2017, 13:51:17 »
Hi datahell,
is there a way to exclude just one category from search? But include ALL other categories?
Logged
datahell
Elxis Team
Hero Member
Posts: 10356
Re: second search engine?
«
Reply #4 on:
June 22, 2017, 20:04:30 »
The easiest way to make the default content search engine to exclude a specific category from search is to exclude that category from category selection drop down box. To do so do the following:
Open file
components/com_search/engines/content/content.engine.php
Go to line
184
:
foreach ($categories as $category) {
Add below:
if ($category['catid'] == 999) { continue; }
Change
999
with the id of the category you want to exclude from selection box.
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
seadhna
Hero Member
Posts: 507
Re: second search engine?
«
Reply #5 on:
June 23, 2017, 10:47:24 »
hmm.... doesn't work? I updated to the very latest version in case that was the issue, but the unwanted category is still visible in search.
Logged
datahell
Elxis Team
Hero Member
Posts: 10356
Re: second search engine?
«
Reply #6 on:
June 23, 2017, 20:18:09 »
The code is correct. If you still see that category then you use wrong category id. Go to admin, edit the category to see its id.
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
seadhna
Hero Member
Posts: 507
Re: second search engine?
«
Reply #7 on:
June 27, 2017, 15:36:02 »
Gosh, I don't know what I'm doing wrong. I have even added all the subcategories, but the pages inside still show up in the search engine. Here is the portion of code, have I done something wrong? The category IDs are definitely correct:
$categories = $this->getCategories();
if ($categories) {
$prf = '- ';
$sfx = '';
if ($eLang->getinfo('DIR') == 'rtl') { $prf = ''; $sfx = ' -'; }
$options = array();
$options[] = $form->makeOption(0, $eLang->get('ALL_CATEGORIES'));
foreach ($categories as $category) {
if ($category['catid'] ==
{ continue; }
if ($category['catid'] == 38) { continue; }
if ($category['catid'] == 39) { continue; }
if ($category['catid'] == 40) { continue; }
if ($category['catid'] == 52) { continue; }
if ($category['catid'] == 54) { continue; }
if ($category['catid'] == 59) { continue; }
$options[] = $form->makeOption($category['catid'], $category['title']);
if (count($category['subcategories']) > 0) {
foreach ($category['subcategories'] as $subcat) {
$options[] = $form->makeOption($subcat['catid'], $prf.$subcat['title'].$sfx);
}
}
}
Logged
seadhna
Hero Member
Posts: 507
Re: second search engine?
«
Reply #8 on:
June 27, 2017, 15:39:45 »
I don't know why there is an emoji here in the code. That is the number eight.
Logged
datahell
Elxis Team
Hero Member
Posts: 10356
Re: second search engine?
«
Reply #9 on:
June 27, 2017, 19:05:24 »
Delete cache!
Open folder
{repository}/cache/com_search/
and you will find in it some php files with an md5 filename. Delete them all!
Example file name:
1f3870be274f6c49b3e31a0c6728957f
.php
Note:
Categories list is saved in the cache folder for
12 hours
. After the 12 hours have passed the file is been refreshed.
«
Last Edit: June 27, 2017, 19:08:09 by datahell
»
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
seadhna
Hero Member
Posts: 507
Re: second search engine?
«
Reply #10 on:
June 29, 2017, 18:39:27 »
Hi datahell, that directory is already empty. Just tried the search again, the unwanted category is still showing up... Anything else you can think of?
Logged
datahell
Elxis Team
Hero Member
Posts: 10356
Re: second search engine?
«
Reply #11 on:
June 30, 2017, 20:08:45 »
No, the instructions are correct. Except if you have given us wrong request. You want to change something else and we modify something else. The instructions I gave you are for the search engine "Content" accessible from component "Search". (
http://www.example.com/search/
)
If you want you can send me a personal message with the username/password for your site's FTP to do that for you.
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
seadhna
Hero Member
Posts: 507
Re: second search engine?
«
Reply #12 on:
July 06, 2017, 12:28:05 »
Thanks datahell, I will PM you now.
Logged
datahell
Elxis Team
Hero Member
Posts: 10356
Re: second search engine?
«
Reply #13 on:
July 06, 2017, 23:28:18 »
Done! The instructions were correct but you had applied them wrong (in subcategories). Also these instructions would hide unwanted categories from category selection drop down list but keyword search would still fetch results from these categories. You hadn't told me that you don't want that. I modified the content search engine and now it works as you want. Test it.
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
seadhna
Hero Member
Posts: 507
Re: second search engine?
«
Reply #14 on:
July 07, 2017, 15:50:50 »
Brilliant! Thanks very much!
Logged
Print
Pages: [
1
]
2
« previous
next »
Elxis CMS Forum
»
Support
»
Elxis 4.x/5.x DEV
»
second search engine?