Developer forum

Forum » Ecommerce - Standard features » Create Indexed search from ProductFieldValue

Create Indexed search from ProductFieldValue

Martijn Bokhove
Reply
Hi

We are developing an Index from ProductFieldValues, in this case for Brands.
The code we used is:

Imports System.Collections.Generic
Imports Dynamicweb
Imports Dynamicweb.Searching
Imports Dynamicweb.NewsV2
 
Namespace Edmac.Lib.Indexers
    'Creating your own index
    'Read related article http://volpav.wordpress.com/2010/12/22/new-search-in-dynamicweb-creating-your-own-index/
    <IndexerIdentity("SearchIndex_Brands""Brands")> _
    Public Class SearchIndex_Brands
        Inherits Indexer
        Protected Overrides Function Index(ByVal request As IndexerDataRequestAs IEnumerable(Of IndexEntry)
            
            Dim ret As New List(Of IndexEntry)()

            Dim iIndex As Integer = 1
            Using ta As New dsEdmacTableAdapters.BrandsTableAdapter
                Using dt As dsEdmac.BrandsDataTable = ta.GetBrands
                    If dt.Rows.Count > 0 Then
                        For Each dr As dsEdmac.BrandsRow In dt.Rows
                            ret.Add(New Searching.IndexEntry(iIndex, dr.Brand))
                            iIndex += 1
                        Next
                    End If
                End Using
            End Using
 
            Return ret
        End Function
    End Class
End Namespace

It works, the Index is visible by Index -> Search and we are able to update the Index.

The reason why we made this own Index is to trying increase the speed using ProductFieldValues in the filters.
Is this the correct way to make an own Index for ProductFieldValues, and does it have any effect on the filters?

Gr
Martijn

Replies

 

You must be logged in to post in the forum