dotCMS Site Search result shows wrong title

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

dotCMS Site Search result shows wrong title

Nafi Haque
I am seeing an issue with the Site Search results on our Dev environment.

So whenever I am getting the site search results object back, the title of a specific search result is being pulled from a <title> tag in the content randomly. For example, I have an HTML document where there is a <title> tag within the <head> of that page. Now the same page has other <title> tags in it's footer which are coming through social icons such as instagram. Exact line: <title id="instagramIcon">Instagram icon</title>

What the search result is doing, it is pulling the above <title> tag and giving the title of the document to be "Instagram icon".

Following is the snippet of code:

#set($searchresults = $sitesearch.search("title:$keyword description:$keyword", 0, 20))
#if($searchresults.totalResults > 0) #foreach($result in $searchresults.results)
  #foreach($result in $searchresults.results)
    <h1>$result.title</h1>
  #end
#end

Note that on my local environment after deleting index and re-creating I am able to get the right title which is the <title> tag inside <head>. Any idea why site search behaving differently or how I can manage/control the title of the document?

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/abc90788-0d70-4b62-bbbf-ed7010dd638a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: dotCMS Site Search result shows wrong title

Jason Tesser
The site search should read the title in the head assuming it exists.  Maybe it is malformed HTML. 

I would start from a clean site search index just to make sure 

On Mon, Nov 13, 2017 at 10:40 PM Nafi Haque <[hidden email]> wrote:
I am seeing an issue with the Site Search results on our Dev environment.

So whenever I am getting the site search results object back, the title of a specific search result is being pulled from a <title> tag in the content randomly. For example, I have an HTML document where there is a <title> tag within the <head> of that page. Now the same page has other <title> tags in it's footer which are coming through social icons such as instagram. Exact line: <title id="instagramIcon">Instagram icon</title>

What the search result is doing, it is pulling the above <title> tag and giving the title of the document to be "Instagram icon".

Following is the snippet of code:

#set($searchresults = $sitesearch.search("title:$keyword description:$keyword", 0, 20))
#if($searchresults.totalResults > 0) #foreach($result in $searchresults.results)
  #foreach($result in $searchresults.results)
    <h1>$result.title</h1>
  #end
#end

Note that on my local environment after deleting index and re-creating I am able to get the right title which is the <title> tag inside <head>. Any idea why site search behaving differently or how I can manage/control the title of the document?

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/abc90788-0d70-4b62-bbbf-ed7010dd638a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--



3059 Grand Avenue
Suite 410-B
Miami FL 33133
Main: 
305-900-2001 | Direct: 978.294.9429

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/CAKKUxWeYMuL20U9VnssNYKR1CFMPqADkd0MD9xy2xuh2dbjV2Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.