I want to implement search functionality, So my requirement is I want to search some keyword in body tag in all content page. I do not know how I can search keyword in body tag in Sitecore. Please guide me?
相关问题
- How to pass “[Sitecore Mobile SDK] Data from the i
- How can I remove duplicated page events in Sitecor
- Spoof an IP address to test GEOIP lookups with Sit
- How to get a Multilist with Search field to not di
- Page.Header.Controls.Add(control) is adding contro
相关文章
- Sitecore set/change default language from 'en&
- Sitecore OMS - achieving a goal on a form submissi
- Get number of components in placeholder, Sitecore
- Sitecore text search in PDF or Word documents
- sending data from one sublayout to another in site
- The model item passed into the dictionary is of ty
- How to implement Solr into Sitecore
- Sitecore enables accessing child node around paren
As Anton outlined, the concept of searching the Body tag is wrong for Sitecore. You want to think in terms of Content in fields of Items. Sitecore's ContentSearch is how you can achieve this.
Sitecore comes with default indexes out-of-the-box that you should use for the search. You should rebuild these via the Index Manager in the Content Editor and then base your search on the basic example I've outlined for you below.
jRobbins's answer is sensible (he get's my upvote). However, it is technically possible to index the content of the body tag. I would be cautious with this. I've seen it working well, but I've also seen it completely destroy the performance of a site.
The approach involves the creating a
computed field
in your index. You populate the computed field by making a web request to your newly published page and scraping the response body tag.Here's are a couple of module that more or less does that:
If you can accept something a little less accurate, then you could loop through each of the components on your page and extract content from their datasources. That approach is discussed in this video: http://www.techphoria414.com/Blog/2012/May/Sitecore_Page_Editor_Unleashed