4

We have a page display of a view that contains two or more nodes, but when searching for a keyword that would pertain to those nodes, only links to the individual nodes are returned. What we really want is just the link to the page display of the view to be returned, but it doesn't show up in the results list.

I'm looking into caching the View and index the cached content through a custom module, but i was wondering if anyone has come across this situation and can share their solution?

edited: made some clarifications.

1

There is the Search by Page module that allows this (and much more). Some details from its project page:

This module is an enhancement to the core Drupal search module, which adds a new tab to the core Search page or can also be used in stand-alone mode. The differences between Search by Page and the existing tabs in the core Search module lie in what is indexed for searching and how it is indexed:

  • Search by Page indexes the content of your pages as rendered by your theme (Search indexes the default rendering you would have from an unmodified theme)
  • Search by Page allows you to omit content from indexing (such as "database table" node types that should never be viewed as stand-alone content)
  • Search by Page allows you to index non-Node pages, including user profiles, file attachments, and Views
  • Search by Page is language-aware, so it only shows you results in the current language.
  • Search by Page has multiple search "environments", so you can have different search pages/blocks to search different things.

Maybe you can use that or look how they index the views pages.

0

Search in drupal is entirely themeable - meaning you can alter the markup.

@see

You could invoke your view programmatically in search-result.tpl.php using an argument of nid

  • I might not have explained the situation properly, not sure if your answer applies. The view containing the nodes is what i want to return when searching for a keyword that is part of its content, and not the nodes themselves. I think your solution is for returning a view of results...unless i didn't understand your solution correctly. – nymo Mar 14 '11 at 21:49
0

From your question, it is very hard to determine if you are talking about an actual view, or search. But I'm going to assume you are talking about a view that has an exposed filter.

When you create a view with an exposed filter, the results upon submission usually stay formatted the same unless another display is involved. In the case that another display is taking care of results, then you would simply modify that display to format the results in the desired way, by either changing the style or the fields being displayed and their options.

It would help if you could explain your question a bit more, providing details on the actual view's setup/structure. This is actually the reason Earl first created the ability to 'export' a view. If you can provide an export of your view, it will be easier for others to help you.

0

"The view containing the nodes is what i want to return when searching for a keyword that is part of its content, and not the nodes themselves"

You can either let views handle all your searching on your site, or embed the view into your search-results.tpl.php, but the latter is counter productive.

0

i have been struggling for customizing "D8 Search Index". Though there are many solutions and discussion, it's really not possibly to get it configured the way you want, unless you really get your hands dirty with twig templates.

i believe in less coding. This allows end-user to customize things without actually entering the code. So i was looking to avoid coding as much possible.

"search pages" in "search & meta" config gives you path of /search/node. Create your own view and give it path "search/node" Then add contextual filter "search keyword" and select "provide default value" as "query parameter"... there specify parameter as "keys" .. customize other things like title, grouping as you may want. dont forget cache! views gives you lot of power!

Check output by searching. see my search page with grouping "https://shabdakosh.marathi.gov.in/search/node?keys=knowledge"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.