Needs review
Project:
Swish-E Indexer
Version:
5.x-1.1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 Jun 2008 at 21:46 UTC
Updated:
6 Nov 2008 at 17:45 UTC
On Drupal 5.7 system, getting this error when executing search after clicking on "Files" tab:
* warning: Invalid argument supplied for foreach() in modules/node/node.module on line 521.
* warning: implode(): Bad arguments. in modules/node/node.module on line 525.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE in includes/database.mysql.inc on line 172.
Attached screenshot as well. Correct file is returned, but with these warnings.
Is this some configuration issue on my part? Thanks for any assistance.
| Comment | File | Size | Author |
|---|---|---|---|
| swishSearchError.jpg | 75.63 KB | somebodysysop |
Comments
Comment #1
somebodysysop commentedOK, after a day or so, I believe I have a much better understanding of what's going on. There are three overall problems that I see. I think I should deal with each as a separate issue.
The first appears to be the path of files displayed on the search results. Swish-e indexes files recursively, so all applicable files under the "files" directory are indexed, including subdirectories.
However, on the search results, the swish.module code inserts variable_get('file_directory_path', 'files') as the default path to each file (regardless of it's actual filepath). Therefore, for example, on the file search results screen, files/file1.doc will display the correct link and "Containing node", but files/subdir/file2.doc will not, hence the warning:
Now, it appears that each time you also do a
_swish_do_index(), you do an_swish_do_update()which populates the swish_fulltext table with all the correct filepaths.So, my proposed logic for the search results list would be to get the correct filepath for each file from the swish_fulltext table, which will also retrieve the correct node information. The proposed code changes:
If this looks OK and makes sense, I'll happily supply a patch.
Comment #2
somebodysysop commentedTechnical note on my proposed code change:
I know that:
should actually look more like:
The problem is that the latter code does not work. If someone has a more appropriate way to do this, I'd love to see it!
Comment #3
somebodysysop commentedComment #4
yasHello,
To ensure your process, I suggest the check of $text_item object like this:
In my case, it happened that a file of $basename is actually existing but there is no result from {swish_fulltext}.
Comment #5
somebodysysop commentedTo answer my question about how to format the query:
This not only insures the correct
%character is inserted, but also that files/file.txt doesn't false match files/bigFile.txt. The previous code allowed this to occur.Comment #6
derbenito commentedHello. Is there I solution for the problem. I have tried your code-changes but I get still the same error.
Thanx
Ben
Comment #7
somebodysysop commentedI ended up writing my own version of this module to specifically handle OG based files. I don't know if this will help you, but below is the code I use (successfully):
Note that in my code I search the "file" table as well. This is NOT a part of the official Swish-E module code.