Closed (fixed)
Project:
Display Suite
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
18 Apr 2012 at 01:32 UTC
Updated:
25 Jun 2012 at 15:24 UTC
Jump to comment: Most recent file
Comments
Comment #1
markhalliwellAttaching patch.
Comment #2
markhalliwellAttaching new patch. Changes "Snippet" to "Search snippet" in the field UI.
Comment #3
markhalliwellComment #4
markhalliwellTonight isn't my night lol sorry for all the comments. Found one thing, the build of the node view should probably be "search_index". This will allow the appropriate gathering of content that's actually searchable.
Comment #5
swentel commentedThis should be search_result. Node modules does this as well.
There's a bigger second problem here though. We're actually going to call node_view twice now, because the view callback is again called in ds_search_search_page(). It should avoid that at all cost. Maybe we should pass along the $build and check for it in ds_search_search_page() to avoid the performance hit.
Comment #6
markhalliwellNode module also isn't customizing the search results display by adding a "Search snippet" field. I originally tried using
search_result, but it only returned the title of the node (I only have the node title and search snippet for my search results display). So, I setup a search index display as well. This way the search results snippet (for DS) can use the search index display as it's source and create a valid snippet against fields that aren't shown on the search results display.I looked in
ds_search_search_page(), but didn't see this mentioned callback in the function or any sub-functions. The only othernode_view()that I see is for Apache Solr multisite support. Was this removed from the 7.x-2.x branch?Comment #7
swentel commentedHmm, that's actually a good thought, never saw it like that, so yeah, search_index would be valid there. However, it still leaves us two node_view() callbacks, which we really need now since we're rendering different view modes. In ds_search_search_page() you'll find ds_entity_view_fallback(). That function either uses entity or falls back to the original view function.
Now, personally, and at work, we never use core search anymore, however, there's people out there that probably do, so we really need to make sure those 2 node_view() callbacks aren't a big performance hit here.
Comment #8
markhalliwellSeems to only be a 15ms (mean) increase, doesn't appear to be that bad? I'm only starting to get familiar with benchmarking.
Without calling
node_view($node, 'search_index')and not displaying the original search snippet:With calling
node_view($node, 'search_index')and displaying the original node search snippet:Comment #9
swentel commentedThat's indeed not that bad. Hmm ok, maybe just one thing: could we make search snippet for node search optional maybe ? With a checkbox on the ds search configuration screen in the node fieldset. I think it could use a description on how to actually configure then the view modes so you get the best results. Because, ironically, most people use DS to completely remove that default search result output, and I don't want them to get any overhead from the snippet calculation if they're not going to use the snippet field at all. If you could get that in the patch, I feel comfortable committing the patch :)
Comment #10
markhalliwellSweet. I think it'd be far better to determine whether or not the search snippet is actually being used. This could function as the "on/off" switch so it doesn't call the
node_view()again. Let me dig around some more to come up with a solution.Comment #11
markhalliwellI believe we have a winner! I was actually able to get the patch down to -1ms (basically no impact what so ever). I was also able to not render the snippet unless the field is actually present in the display.
Without patch:
With patch:
Comment #12
swentel commentedLooks good, committed and pushed, thanks!
Comment #14
BarisW commentedJust to make sure, does this only work for Apache SOLR? I don't see the field in Drupal core search.
Comment #15
markhalliwellThis patch actually adds the core search module's snippet and removes the conditional SOLR if clause so it will either use SOLR (if it is installed and configured properly) or the default core search snippet.
This patch is for the 7.x-2.x branch only. My guess is that if you're not seeing this field, then you are probably using the stable 7.x-1.x branch which only has support for the SOLR snippet. I don't believe this patch will make its way back to 1.x, at least not at the moment.
Comment #16
swentel commentedWill commit this to 7.x-1.x branch as well
Comment #17
swentel commentedJust committed!
Comment #17.0
swentel commentedUpdated issue.