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

Joes Revolver Map

Donate & Support

If you like my content, and would like to support this sharing site, feel free to donate using a method below:

Paypal:
Donate to Joel Lipman via PayPal

Bitcoin:
Donate to Joel Lipman with Bitcoin bc1qf6elrdxc968h0k673l2djc9wrpazhqtxw8qqp4

Ethereum:
Donate to Joel Lipman with Ethereum 0xb038962F3809b425D661EF5D22294Cf45E02FebF
© 2024 Joel Lipman .com. All Rights Reserved.