Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

PortalWebHosting
  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
OnyakTech
 


  Sponsors  

Meet Our Sponsors

SteadyRain
DataSprings - Great Ideas. Always Flowing.
R2integrated - formerly bi4ce
Jango Studios - Skins, Modules and Hosting for DotNetNuke
eUKhost.com is commited to offer exceptional UK Windows Web Hosting solutions with quality 24x7 technical support.Our plans support ASP.Net, ASP, ASP.NET Ajax extensions, XML, MSSQL, MySQL, PHP,DNN, multiple domains and Shared SSL as standard.
SmarterTools
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! ( Pr...  DNN 3.x Search Optimizations
Previous Previous
 
Next Next
New Post 6/20/2007 1:29 PM
User is offline Eric Sarjeant
1 posts
www.wilsonmiller.com
10th Ranked


DNN 3.x Search Optimizations 

Many DNN users have had a similar experience with the limited results that DNN search offers particularly in the DNN 3.x versions. We are running DNN 3.0.13 and in addition to many other customizations we have recently retrofitted DNN search to dramatically improve results on our site.

Our primary issue had to do with the fact that we did have content but in many cases they were links to other content and while the link was descriptive the search indexer was unable to find it. The fix was rather straightforward, here is our modified version of AddIndexWords from the SearchDataStore.vb:

        Private Sub AddIndexWords(ByVal IndexId As Integer, ByVal SearchItem As SearchItemInfo, ByVal Language As String)
            Dim IndexWords As New Hashtable
            Dim IndexPositions As New Hashtable
            Dim setting As String
            'Get the Settings for this Module
            _settings = SearchDataStoreController.GetSearchSettings(SearchItem.ModuleId)
            setting = GetSetting("MaxSearchWordLength")
            If setting <> "" Then
                maxWordLength = Integer.Parse(setting)
            End If
            setting = GetSetting("MinSearchWordLength")
            If setting <> "" Then
                minWordLength = Integer.Parse(setting)
            End If
            setting = GetSetting("SearchIncludeCommon")
            If setting = "Y" Then
                includeCommon = True
            End If
            setting = GetSetting("SearchIncludeNumeric")
            If setting = "N" Then
                includeNumbers = False
            End If
            Dim Content As String = CStr(IIf(SearchItem.Content Is Nothing, String.Empty, SearchItem.Content))
            Dim Title As String = CStr(IIf(SearchItem.Title Is Nothing, String.Empty, SearchItem.Title))
            Dim Desc As String = CStr(IIf(SearchItem.Description Is Nothing, String.Empty, SearchItem.Description))
            ' clean content
            Content = HtmlUtils.Clean(Content, True)
            Title = HtmlUtils.Clean(Title, True)
            Desc = HtmlUtils.Clean(Desc, True)
            ' create a content string that includes the Title and Description
            ' copy the Title twice to place added weight on the words in the title
            Content = String.format("{0} {1} {2} {3}", Title.ToLower, Title.ToLower, Desc.ToLower, Content.ToLower)
 
            '' split content into words
            Dim ContentWords() As String = Split(Content, " ")
            ' process each word
            Dim intWord As Integer
            Dim strWord As String
            For Each strWord In ContentWords
                If CanIndexWord(strWord, Language) Then
                    intWord = intWord + 1
                    If IndexWords.ContainsKey(strWord) = False Then
                        IndexWords.Add(strWord, 0)
                        IndexPositions.Add(strWord, 1)
                    End If
                    ' track number of occurrences of word in content
                    IndexWords(strWord) = CType(IndexWords(strWord), Integer) + 1
                    ' track positions of word in content
                    IndexPositions(strWord) = CType(IndexPositions(strWord), String) & "," & intWord.ToString
                End If
            Next
            ' get list of words ( non-common )
            Dim Words As Hashtable = GetSearchWords()    ' this could be cached
            Dim WordId As Integer
            '' iterate through each indexed word
            Dim objWord As Object
            For Each objWord In IndexWords.Keys
                strWord = CType(objWord, String)
                If Words.ContainsKey(strWord) Then
                    ' word is in the DataStore
                    WordId = CType(Words(strWord), Integer)
                Else
                    ' add the word to the DataStore
                    WordId = Data.DataProvider.Instance().AddSearchWord(strWord)
                    Words.Add(strWord, WordId)
                End If
                ' add the indexword
                Dim SearchItemWordID As Integer = Data.DataProvider.Instance().AddSearchItemWord(IndexId, WordId, CType(IndexWords(strWord), Integer))
                Data.DataProvider.Instance().AddSearchItemWordPosition(SearchItemWordID, CType(IndexPositions(strWord), String))
            Next
        End Sub

The modifications are highlighted in bold. Adding this improves index results for cases where the content may be limited but there are descriptive links to other content. In addition, the duplication provides added relevancy and helps in cases where the specific word may be competing with itself in another location but the version with the title should always take precedence.

Finally, GetSearchWords() has to be modified to accomindate a discreprency in the Hashtable, where it was indexed on the WordId but was queried on the Word. This improved our SearchWord table and prevents it now from growing out-of-control.

 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Extend It! ( Pr...  DNN 3.x Search Optimizations
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


Glanton: Enterprise Intranet Specialists Using DNN
Glanton Solutions are a premier provider of sevices for large corporates lloking to outsource Intranet sites.
www.glanton.com
Jetkey Smart Map
Smart Map is an AJAX powered Google Map module that displays driving directions, proximity search results and data from your own databases. Smart Map reads GPX (GPS data) files, GeoRSS feeds, and KML data. You can pass any querystring parameter to Smart Map and into your own custom queries to control what data displays on the map.
smartmap.jetkey.com
DNNSpired.com
Inspired to extend DotNetNuke®, everyday.
www.DNNSpired.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP