All questions about EDocman extension

Search Only PDFs?

  • BEC Legal Systems
  • Topic Author
  • Offline
  • New Member
  • New Member
More
11 years 3 months ago #24617 by BEC Legal Systems
Search Only PDFs? was created by BEC Legal Systems
Is there a way to construct an eDocMan search module that only searches files of type PDF?

Please Log in or Create an account to join the conversation.

  • Tuan Pham Ngoc
  • Away
  • Administrator
  • Administrator
More
11 years 3 months ago #24633 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: Search Only PDFs?
Hi Ron

Unfortunately, this feature is not available in the extension at the moment. So if you want to have this feature, I think you will need to customize the extension :

1. Customize the extension to store to the file type of each document.

2. Customize the search function to make it search based on file type.

Tuan

Please Log in or Create an account to join the conversation.

  • BEC Legal Systems
  • Topic Author
  • Offline
  • New Member
  • New Member
More
11 years 2 months ago #24950 by BEC Legal Systems
Replied by BEC Legal Systems on topic Re: Search Only PDFs?
Thanks. I found a convenient and reliable enough method by creating conditions wherein the WHERE clause is constrained to include a check against the end of the original_filename.

I've got it working now, thanks.

Please Log in or Create an account to join the conversation.

  • BEC Legal Systems
  • Topic Author
  • Offline
  • New Member
  • New Member
More
11 years 2 months ago - 11 years 2 months ago #24951 by BEC Legal Systems
Replied by BEC Legal Systems on topic Re: Search Only PDFs?
In the spirit of the GPL, I'll include my changes for those interested...

I modified onContentSearchAreas to include a new member (and re-titled the existing key for clarity):
Code:
function onContentSearchAreas() { static $areas = array( 'edocman_search_documents' => 'Documents', 'edocman_search_downloads' => 'Downloads' ); return $areas; }

I then added a conditional evaluation to concatenate $where with checks for filetype as determined by the end of the original filename:
Code:
$user = & JFactory::getUser() ; $isfirstarea = '1'; $where = $where . ' AND ('; foreach ($areas as $area) { if ($area == 'edocman_search_documents') { if (!$isfirstarea) { $where = $where . ' OR '; } $where = $where . 'a.original_filename LIKE \'%.pdf\' OR a.original_filename LIKE \'%.doc\' OR a.original_filename LIKE \'%.docx\''; $isfirstarea = '0'; } if ($area == 'edocman_search_downloads') { if (!$isfirstarea) { $where = $where . ' OR '; } $where= $where . 'a.original_filename LIKE \'%.zip\''; $isfirstarea = '0'; } } $where = $where . ')';

Hope that helps someone else. Tuan, this may be worth patching in with a new version of the search plugin? It's rather lazier than extending the schema of #_edocman_documents to include storing the filetype and then retrieving it, but this works well and predictably enough, I believe.
Last edit: 11 years 2 months ago by BEC Legal Systems.
The following user(s) said Thank You: Jaikishan

Please Log in or Create an account to join the conversation.

Moderators: Mr. Dam