Author Topic: Search except for some pageID's  (Read 1082 times)

Offline Hans

  • Posts: 912
  • Gender: Male
Search except for some pageID's
« on: May 28, 2017, 07:05:01 PM »
Hello friends, another question ;-)

I have a client with a website with pages that have a left column in it. In that column there is a
  • a part (global block) for website-wide text (announcement of a lecture, holiday closure)
  • and a possibility to add an extra section on a per-page basis.
  • As far as the global block concerns there is a possibility to exclude that block from the search. It is a normal page and pages can be excluded from search.
  • But text that makes part of extra sections on the per-page basis are indexed and shown on the search results page. As those texts are often trivial my client wants to be able to exclude some of them from the search.

So my question is:

Is it possible to exclude sections from the search? And of course, if that's the case: how do you do that?
Hans - Nijmegen - The Netherlands

Offline Ruud

  • Posts: 3647
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: Search except for some pageID's
« Reply #1 on: May 28, 2017, 10:46:10 PM »
No, there is no per-section-setting..

What you could do is use the sectionpicker module.
Maintain the sections on a hidden page (search off) and use the sectionpicker to include them on the pages where they should show.

Sectionpicker will call the search functions of the included section when available. To prevent the sectionpicker module to include search data for included sections, simply remove the sectionpicker search.php.

Offline Hans

  • Posts: 912
  • Gender: Male
Re: Search except for some pageID's
« Reply #2 on: May 29, 2017, 11:54:17 AM »
Thanks Ruud, gonna try that!
Hans - Nijmegen - The Netherlands

Offline Hans

  • Posts: 912
  • Gender: Male
Re: Search except for some pageID's
« Reply #3 on: May 29, 2017, 12:16:52 PM »
That does the trick! Thanks again.

The only thing is that it's hard to see which section to chose (the dropdown only point to a wysiwyg, 1. in the image, but this way they have all the same name). Would be nice if it mentioned the Title of the section (2. in the image).
I hope it's possible and that you have time to implement this.

Image: https://www.dropbox.com/s/gjx8qwjom7eycwq/2017-05-29_120956.png?dl=0
Hans - Nijmegen - The Netherlands

Offline Hans

  • Posts: 912
  • Gender: Male
Re: Search except for some pageID's
« Reply #4 on: May 29, 2017, 12:40:40 PM »
Unfortunately I was too quick.. it doesn't work even if I set search off in both the page containing the sections and the "receiving" page.

In the meantime it might be a good idea to alter the behaviour of the dropdown as mentioned in the last post nevertheless.
Hans - Nijmegen - The Netherlands

Offline Ruud

  • Posts: 3647
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: Search except for some pageID's
« Reply #5 on: May 29, 2017, 12:49:50 PM »
The trick should be:

1. turn search off in the hidden page (so it will not be included in the global search)
2. delete the file /modules/sectionpicker/search.php

The second step will stop the sectionpicker module to relay search data from the included sections.

Offline Hans

  • Posts: 912
  • Gender: Male
Re: Search except for some pageID's
« Reply #6 on: May 29, 2017, 01:01:29 PM »
Hi Ruud
Sorry, you said that before.... but I forgot!
Hans - Nijmegen - The Netherlands

Offline Ruud

  • Posts: 3647
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: Search except for some pageID's
« Reply #7 on: May 29, 2017, 04:29:34 PM »
The only thing is that it's hard to see which section to chose (the dropdown only point to a wysiwyg, 1. in the image, but this way they have all the same name). Would be nice if it mentioned the Title of the section (2. in the image).
I hope it's possible and that you have time to implement this.

Have a look:
https://dev4me.com/modules-snippets/opensource/sectionpicker/

Offline Hans

  • Posts: 912
  • Gender: Male
Re: Search except for some pageID's
« Reply #8 on: May 29, 2017, 10:48:41 PM »
Wow, THANKS!!
Hans - Nijmegen - The Netherlands

Offline Ruud

  • Posts: 3647
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: Search except for some pageID's
« Reply #9 on: May 29, 2017, 10:52:51 PM »
Wow, THANKS!!
8-)

Don't forget to delete the search.php again after upgrading.

Offline Hans

  • Posts: 912
  • Gender: Male
Re: Search except for some pageID's
« Reply #10 on: May 29, 2017, 11:48:29 PM »
 (Y)
Hans - Nijmegen - The Netherlands

 

postern-length