Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Near the top of node_trip_search it adds the MATCH clause to $query->wheres if mysql_full mode is in use. If comment module is present it adds subject/comment to $query->fields. When the query is put together you get all the fields OR'ed together (match if any specified field matches) but the MATCH is AND'ed in.. ie, even if a comment matches it won't return that topic unless the MATCH clause also evaluates to true. When fulltext is not in use you get node title/body in $query->fields so everything is properly OR'ed together.
Comment | File | Size | Author |
---|---|---|---|
#9 | trip_search.module_diff.txt | 9.57 KB | mindless |
#4 | trip_search.module_patch_0.txt | 12.84 KB | mindless |
#3 | trip_search.module_patch.txt | 12.77 KB | mindless |
#1 | trip_search.module_fulltext_patch.txt | 2.67 KB | mindless |
Comments
Comment #1
mindless CreditAttribution: mindless commentedHere is my quick fix for this problem.. it now ORs the MATCH clause with the clauses generated by $query->fields. Patch is against current CVS. Hope this helps..
Comment #2
mindless CreditAttribution: mindless commentedHm, I suppose rather than:
this would be more appropriate:
Though since with the current code $query->fields is never empty, this doesn't really matter.
Comment #3
mindless CreditAttribution: mindless commentedThe previous patch created significant performance problems now that the LEFT JOIN on comments table must actually be processed. We now use a new fulltext index on comments table (subject,comment) and a separate query to check comments. New patch against cvs is attached. Note this patch also includes some fixes we use for proper escaping of quotes (though we run 4.6; hopefully I got everything right in this cvs patch). Note the "filter results by category" counts are still based only on node matches; comment matches not counted.
Comment #4
mindless CreditAttribution: mindless commented..and one more update to the patch to fix another bug.. user:"user name" syntax (this syntax is generated by advanced search but then not parsed correctly).
Comment #5
nedjoThanks for the improvements, apologies that I haven't found a chance to test this. Would you be willing to fix any new bugs that the patch may raise? If so, please go ahead and apply it.
Comment #6
mindless CreditAttribution: mindless commentedStatus: I applied the user:"user name" fix mentioned in comment #4. nedjo has already applied some of the other search-term-parsing fixes. These parts of the patch above are now in CVS:
@@ -307,7 +307,7 @@
@@ -554,6 +554,7 @@
@@ -700,18 +701,15 @@
Now the remaining parts of the patch file relate just to this bug report :-)
Comment #7
joel_guesclin CreditAttribution: joel_guesclin commentedI've taken on trip_search in 4.7 - but ran into the same problem with comments and for the moment have removed it altogether. Is there any interest in looking at this subject again? The code has changed a lot though...
Comment #8
mindless CreditAttribution: mindless commentedwe've had to disable search.module due to performance problems, so yes we'd certainly be interested if trip_search worked on 4.7 and could search comments.
Comment #9
mindless CreditAttribution: mindless commentedmy work-in-progress, if you'd like to take a look.
Comment #10
joel_guesclin CreditAttribution: joel_guesclin commentedThanks - I am waiting for approval for a new version which will have changed a fair bit once again, in order to overcome XSS vulnerability. Once that is available, if you would like to have a look again at including comments I would certainly be interested.
Comment #11
mindless CreditAttribution: mindless commentednew code using a fulltext index on comments table now in DRUPAL-4-7 branch.
Comment #12
(not verified) CreditAttribution: commented