0

Is there a method of giving a user the ability to search any term within all content of a particular node through an exposed form. For example you have the content type of, say - Business, with the fields of - CEO and Base of Operations. Could you give them a simple search that looks for a match in both those fields?

1 Answer 1

1

This is certainly possible and there can be many approaches to this, but it would require some effort in any case.

Taxonomy terms are not indexed by core search, therefore you would need to rely on a third party module. Such popular modules are Search API and Apache Solr.

My preferred method, in short, is to use the Search API in combination with Views:

  • Install the modules Search API, Search API DB, Views, Ctools.
  • Create server and index, add the taxonomy fields in the index.
  • Create a view for the search page based on the index
  • Filter by eg. "Search: Fulltext search", exposed
  • Add any fields to view, such as "Rendered entity" (for teasers etc.)
  • Sort by any field, such as "Search: Relevance".
7
  • 1
    You can use search_api in combination with search_api_solr, as well drupal.org/project/search_api_solr
    – Ollie
    Feb 27, 2014 at 13:39
  • I've never used taxonomy (or at least not that I was aware of). How does taxonomy have anything to do with searching content. Doesn't taxonomy just apply 'tags' to content? Feb 27, 2014 at 13:41
  • Sure. You can use for example a simple view from the Views module to present content classified by tags. But in your question you ask about searching in an exposed form.
    – Wtower
    Feb 27, 2014 at 13:43
  • So your answer doesn't require the use of taxonomy? Feb 27, 2014 at 13:46
  • My answer assumes that you already use taxonomy. You need to have a taxonomy field in your content type in order for the search index to include it, and obviously for it to have some values if you need to search for them in the exposed field.
    – Wtower
    Feb 27, 2014 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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