Joes Search Module (JSM)

What?
This article serves as documentation for a Joomla extension I have released which is a copy of the built-in Joomla Search module but with the parameters embedded (set in the administration section).

Why?
A client has a repository of PDF documents that are uploaded to a folder. The client also purchased OS PDF Indexer by OS Solutions and installed this.

The client wanted restricted users to be able to search the PDF indexer but not to return any other Joomla articles from other categories. Public users should not be able to use this search or see the restricted documents. I've googled far and wide but as usual, I find myself to be the first to address this.

How?
The module I have made is very basic and not in an MVC structure but it has been tested on Joomla 2.5.28 and Joomla 3.3.1. It simply displays a search module form (same as the default install) only with the additional hidden fields: limit, search phrase (all, any, exact), ordering, and areas (set to doc_indexer by default as per the component).

The parameters are changed in the back-end of the site (Joomla admin panel). The functionality and component are simply an extension to the existing Joomla Search. There are no changes to the existing component.

Download
You can download this module I made from my download section at http://www.joellipman.com/features/downloads/product/20.html or search my site for "Joes Search Module" (or "JSM").

Other Areas:
One of the parameters is entitled "Search Area". This is the component to search so other valid values are:
copyraw
categories
contacts
newsfeeds
weblinks
  1.  categories 
  2.  contacts 
  3.  newsfeeds 
  4.  weblinks 

To determine yours, do a standard search on your website and check the search results page. There should be several additional options to your search that will be displayed under the "Search Only:" heading and then a list of components. Find the value of the checkbox by viewing the HTML source and you should see something like the following:
copyraw
<input type="checkbox" name="areas[]" value="doc_indexer" id="area-doc_indexer">
// take the value of the checkbox (eg. doc_indexer)
  1.  <input type="checkbox" name="areas[]" value="doc_indexer" id="area-doc_indexer"> 
  2.  // take the value of the checkbox (eg. doc_indexer) 

I have set the module by default to only search one area, but you can include multiple components by separating these with a comma. This parameter is a text field which uses the alias of the component (eg. "doc_indexer"), you would need to modify this to the component you want it to search.

More than one area
I have added the hidden fields in the HTML form (generated in PHP) in the following file: mod_joesearch.php. Simply add each component name separated by a comma (eg. "doc_indexer, weblinks"):
copyraw
<input type="hidden" name="areas[]" value="doc_indexer">  // add doc_indexer to search
<input type="hidden" name="areas[]" value="weblinks">     // search weblinks as well
  1.  <input type="hidden" name="areas[]" value="doc_indexer">  // add doc_indexer to search 
  2.  <input type="hidden" name="areas[]" value="weblinks">     // search weblinks as well 

Form attributes
I have set these to the following:
copyraw
action  = /index.php?option=com_search
method  = post
role    = search
  1.  action  = /index.php?option=com_search 
  2.  method  = post 
  3.  role    = search 

Issues
Further searches do not include the same filters. This will be because the setting to display search areas has been switched off in the admin panel. You should keep this enabled so that the filters are carried through to the next search:
  1. Go to Components > Search > Options > set "Use Search Areas" to "Yes"
  2. Save & Close


Future Developments
This was created for a client and I do not know of any other use this module has. If there is a demand for it, I would add the category parameter to restrict searches as I see from Google searches that this does not exist as yet.

Comments/Questions
Please use the comment box below to add any questions (you can even post anonymously) or suggestions you might have. Thank you for your time!

« DOWNLOAD ݏ


Category: Product Documentation :: Article: 603

Add comment

Your rating:

Submit

Credit where Credit is Due:


Feel free to copy, redistribute and share this information. All that we ask is that you attribute credit and possibly even a link back to this website as it really helps in our search engine rankings.

Disclaimer: Please note that the information provided on this website is intended for informational purposes only and does not represent a warranty. The opinions expressed are those of the author only. We recommend testing any solutions in a development environment before implementing them in production. The articles are based on our good faith efforts and were current at the time of writing, reflecting our practical experience in a commercial setting.

Thank you for visiting and, as always, we hope this website was of some use to you!

Kind Regards,

Joel Lipman
www.joellipman.com

Please publish modules in offcanvas position.