Developer forum

Forum » Development » Custom Indexbuilder

Custom Indexbuilder

Aki Ruuskanen
Aki Ruuskanen
Reply

Hi,

I'm working with a custom index builder and are adding stuff to the index like this:

                    var document = new IndexDocument
                    {
                        ["ContentType"] = IndexContentType.PDF_CONTENT,
                        ["AreaId"] = reader["PageAreaID"],
                        ["ContentName"] = reader["Filename"],
                        ["Language"] = language,
                        ["PDFLink"] = LinkToFile(fileInfo.FullName),
                        ["ContentText"] = fileConent,
                        ["DirectoryFullName"] = fileInfo.DirectoryName
                    };

It all works fine. 

What I cant figure out is how I should work with relations. 

If I, for example, have a product that I index. How do I create relations to the product images. I would appriciate an example of this. 

Regards / Aki

 

 

 


Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer
That would be arrays - something like this:
["Products"] = new Array["prod1", "prod2"]
Votes for this answer: 1
 
Aki Ruuskanen
Aki Ruuskanen
Reply

Exellent. Thanks. 

/Aki

 
Aki Ruuskanen
Aki Ruuskanen
Reply

What about the data for the related "items".

If a have a IndexDocument like this:

var document = new IndexDocument
 {
     ["ProductId"] = "PROD1",
     ["Images"] = new Array["IMG1", "IMG2", "IMG3"] 
 };

How do I handle the data for the "Images". For example path to imageFile. 

/Aki

 
Nicolai Pedersen
Reply
This post has been marked as an answer

You can make an array of json documents and index those. Remember not to analyze and to store the data. Then the objects can be deserialized. Altnertive is to create a field "ImagePaths" and have the paths as array in there in the same order as the references.

BR Nicolai

Votes for this answer: 1
 
Aki Ruuskanen
Aki Ruuskanen
Reply

yesyes

 

You must be logged in to post in the forum