Page 1 of 1

Search Module Searching Different Parts of Sites

Posted: Wed Feb 27, 2008 3:33 am
by donia
I have a medical group site, and within that site is a book (made up of many individual pages).  On the regular site pages, I want to be able to search the entire site - including the book.  On the book pages, I want the search module to only search the book pages.  Is this possible?  It's not clear to me if modules="" would do it, as I'm not really dealing with modules.

Thank you!

Donia

Re: Search Module Searching Different Parts of Sites

Posted: Wed Feb 27, 2008 3:53 am
by calguy1000
The search module doesn't handle this at the moment..... there is currently a single tag to include in page content to exclude that page from ALL searches.

sorry.

Re: Search Module Searching Different Parts of Sites

Posted: Wed Feb 27, 2008 5:12 pm
by donia
I'd like to add a new parameter called book that if present, indicates that I'm doing a book search and to process accordingly.  I have 6 templates, and so I want to only include 1 of them in the book search.  I've posted what I've done below.  The debugging I've done would indicate that the book parameter is empty.  I just don't know why.

Thank you!

Donia


In lang/en_US.php:

Code: Select all

    $lang['param_book'] = 'Used if this search is to search book only';
In Search.module.php:

Code: Select all

   define( "NON_INDEXABLE_CONTENT_BOOK", "<!-- pageAttribute: NotSearchableBook -->" );
    in function SetParameters()

Code: Select all

        $this->CreateParameter('book','null',$this->Lang('param_book'));
        $this->SetParameterType('book',CLEAN_STRING);
   in function DoEvent - case 'EditTemplatePost':  (I've add the to the appropriate templates.)

Code: Select all

             $book =& $params['book'];

              if( $book ) {

	        $non_indexable_book = strpos($template->content, NON_INDEXABLE_CONTENT_BOOK);
              }
              else {
                // this is not a book search; ignore non_indexable_content_book templates
	        $non_indexable_book = false;
              }


	      if ((! $non_indexable) && (! $non_indexable_book))