Hi Robmilne, i have a request about search feature.

I need that search also includes the names of folders and titles and descriptions in file meta data.
Do you think that is possible?

CommentFileSizeAuthor
#5 webfm-6.x-2.12-add_search_button.patch5.34 KBg4b0

Comments

robmilne’s picture

This is all very possible with some mods to the webfm_searchFiles class in webfm.module. I don't have the time these days to help out, but I can review a patch if you feel inclined to try your hand.

matteo82’s picture

I'm not a programmer but I'm trying to do something.....

robmilne’s picture

I wish you luck, however I'm not able to take this on at this time. A proper search indexer of file data and webfm_file table data might be worth researching.

I'd love to see improvement of search, especially for users with large data stores. If someone else could do the footwork I'd be much obliged and very willing to integrate via a patch.

matteo82’s picture

Version: 5.x-2.6 » 5.x-2.13
g4b0’s picture

Version: 5.x-2.13 » 6.x-2.12
Assigned: matteo82 » g4b0
Status: Active » Fixed
StatusFileSize
new5.34 KB

Installing this patch the search is performed through:

1) file name
2) metadata title
3) metadata description

I've also inserted the option to have a separate search button into the admin section, enabling it will show a 'Search' button just above the upload section.

I hope to see my code in the next release :)

nhck’s picture

Title: advanced search » Improve Search feature
Component: Miscellaneous » Code
Status: Fixed » Needs review
nhck’s picture

Status: Needs review » Needs work
g4b0’s picture

What kind of work it needs?

j_smits’s picture

Tried to do the patch but get this error:

File to patch: webfm.module
webfm.module: No such file or directory
Skip this patch? [y] n
File to patch: /Volumes/Werkschijf/Clienten/IFHP/website/_drupal/sites/all/webfm/webfm.module
patching file /Volumes/Werkschijf/Clienten/IFHP/website/_drupal/sites/all/webfm/webfm.module
Hunk #1 FAILED at 68.
Hunk #2 FAILED at 381.
2 out of 2 hunks FAILED -- saving rejects to file /Volumes/Werkschijf/Clienten/IFHP/website/_drupal/sites/all/webfm/webfm.module.rej
can't find file to patch at input line 26
Perhaps you should have used the -p or --strip option?
The text leading up to this was:

--------------------------
|diff -rupN webfm-browser.tpl.php webfm-browser.tpl.php
|--- webfm-browser.tpl.php 2009-07-26 21:50:49.000000000 +0200
|+++ webfm-browser.tpl.php 2010-05-19 14:55:21.547796000 +0200
--------------------------

What does this mean?

Thanx,
jonathan

nhck’s picture

Sorry for the lengthy review. I understand the idea - and in my opinion it is really good! It just needs some work. Lets see what you and others think about this :-)

+++ webfm.admin.inc	2010-05-19 16:34:27.883828000 +0200
@@ -68,6 +68,13 @@ function webfm_admin_settings() {
+          '#title' => t('Display search box (no more right click)'),

This should be just. t('Display a search box.')

+++ webfm-browser.tpl.php	2010-05-19 14:55:21.547796000 +0200
@@ -17,5 +17,7 @@
 <div id="webfm">
+	<div style="clear:both"></div>
+  <?php print $search ?>
   <?php print $upload; ?>

In my opinion this location of the whole search button isn't a really good thing. Don't you think it should be on top? I have like 70 folders and couldn't find it at first.

+++ webfm-browser.tpl.php	2010-05-19 14:55:21.547796000 +0200
@@ -17,5 +17,7 @@
diff -rupN webfm_file.inc webfm_file.inc

diff -rupN webfm_file.inc webfm_file.inc
--- webfm_file.inc	2009-08-19 17:37:09.000000000 +0200

--- webfm_file.inc	2009-08-19 17:37:09.000000000 +0200
+++ webfm_file.inc	2010-05-19 15:06:35.287800000 +0200

+++ webfm_file.inc	2010-05-19 15:06:35.287800000 +0200
+++ webfm_file.inc	2010-05-19 15:06:35.287800000 +0200
@@ -271,4 +271,3 @@ function webfm_insert_dir($path, $recur,

@@ -271,4 +271,3 @@ function webfm_insert_dir($path, $recur,
   }
   return $result;
 }
-?>

You are not using a Drupal5 version are you? Other than that you can leave this out it has been fixed.

+++ webfm.module	2010-05-19 16:39:34.948795000 +0200
@@ -1663,7 +1663,11 @@ function webfm_main () {
+	 $search = '<input type="button" id="webfm-search-button" onclick="Webfm.searchObj.createForm(\'/\');" value="'.$txt.'"/>';

Sorry, but we can't use a button for this at least if it hasn't come through formsAPI.A normal link is the most we can do. However I think it would be a lot more convenient if you could directly type the file name in a real search box without a popup.

+++ webfm.module	2010-05-19 16:39:34.948795000 +0200
@@ -2279,10 +2285,21 @@ class webfm_searchFiles {
+	 if (!in_array($path.$name, $this->tmp_files)) {
+		$this->files[] = $sfd;
+		$this->tmp_files[] = $path.$name;
+		$this->count++;
+	 }

I understand you need to check for duplicates, but isn't it possible to do this by file id. I think its quiet okay if files in different folders have the same name.

+++ webfm.module	2010-05-19 16:39:34.948795000 +0200
@@ -2293,6 +2310,7 @@ class webfm_searchFiles {
+//		  watchdog('webFM',$full_dir."/".$file);

uhm?

Powered by Dreditor.

g4b0’s picture

Sorry for the lengthy reply :P

1) Ok
2) Yes, pheraps it's better to put it in the top
3) I'm using Drupal 6. I think that is just a mistake.
4) The perfect way, in my opinion, it would be a open/close link like "File Upload", and no popup. The problem is that I wasn't able to implement it. Does anybody can give me a hint?
5) I search for file path, not just file name. In that way two files with the same name, but in different folder, will be showed in the search result.
6) Just debug :)

ultimately the only real point that needs development is the fourth, but I can not find a way to solve it because of my unfamiliarity with javascript ... I hope someone can give me an hint on how to do it (maybe the original author of the module).

Sorry for my bad English
g4b0

vmevada102’s picture

hello friends,

thank you for your nice replies..

but tell me how to patch this file... i m somewhat new bee in the drupal ..

but finding so much problem in search in drupal..

please let me know how to install patch this webfile manager search button..

thank you in advance... please help me for this

g4b0’s picture

Hi vmevada102,
Download WebFm 6.x-2.12 (the stable version) and apply the patch following http://drupal.org/patch.

Maybe it works also with last development version, let us know!! It's a work in progress patch, feel free to modify it and send it to us, but read before the discussion above :)

skcgeek01’s picture

I hate to be stupid, but how do I move the search button to the top? I agree with Niels Hackius in that I didn't see it initially as well. Otherwise I do like this as I've had a few users not figure out the 'right click' search.

Thx....

g4b0’s picture

I will fix that, but right now I'm working on other things... For a quick&dirty solutuin you can modify manually the html code into the tpl.

madhusudan’s picture

thanks @g4b0

the patch worked for latest webfm release 6.x-2.x-dev Download (121.72 KB) 2010-Jul-18 , although failed at 2 lines

patching file webfm.admin.inc
Hunk #2 FAILED at 381.
1 out of 2 hunks FAILED -- saving rejects to file webfm.admin.inc.rej
patching file webfm-browser.tpl.php
patching file webfm_file.inc
Hunk #1 FAILED at 271.
1 out of 1 hunk FAILED -- saving rejects to file webfm_file.inc.rej
patching file webfm.module
Hunk #1 succeeded at 655 (offset 19 lines).
Hunk #2 succeeded at 1682 (offset 19 lines).
Hunk #3 succeeded at 2274 (offset 19 lines).
Hunk #4 succeeded at 2288 (offset 19 lines).
Hunk #5 succeeded at 2304 (offset 19 lines).
Hunk #6 succeeded at 2329 (offset 19 lines).
Hunk #7 succeeded at 2342 with fuzz 1 (offset 19 lines). 

now i can search meta-data for 'tittle' and 'description'.
still 'publisher' meta-data not included, never mind ill fix the code :-).

lilon’s picture

subscribing

vmevada102’s picture

thank a lot to provide such good help.

i am very much thank ful to your sir