Problem with Search Indexing feature

Topics: Customizing Orchard
Aug 13, 2011 at 12:03 AM
Edited Aug 13, 2011 at 12:08 AM

I wanted to add my custome contentpart to search index and I went through these steps:

1- Add this code to my content part handeler's constructor :

OnIndexing

<ProductPart>((    

 context,productPart)

 

=> context.DocumentIndex

 .Add("DisplayName",productPart.Record.DisplayName).Analyze()      

 .Add("Name", productPart.Record.Name).Analyze().Store()  

);

2- Enable indexing feature for product type

3- Build search index

It didn't index my contentPart!

 Then I debuged the source code and on this class: IndexingTaskExecutor at the line 146# I commented this part:

Take(ContentItemsPerLoop)

(var contentItems = _contentRepository.Fetch(versionRecord=> versionRecord.Published && versionRecord.Id > indexSettings.LastContentId,order

=> order.Asc(versionRecord => versionRecord.Id))

//.Take(ContentItemsPerLoop)

 

.Select(versionRecord => _contentManager.Get(versionRecord.ContentItemRecord.Id, VersionOptions.VersionRecord(versionRecord.

Id))).Distinct().ToList();)

Then it worked and indexed my content part information. I want to know Did I make a mistake? or did I should set somthing else?

What is the problem?

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Coordinator
Aug 13, 2011 at 1:54 AM

1- Is your part attached to a content type ?
2- Is your content type marked as "Indexed" in the Content Types page
3- Have you created and published a content item of this content type ?

Aug 13, 2011 at 11:52 PM

My type is Product and the part is ProductPart and my part has been attached to the type, the type is marked as Indexed and yes each product has content item. but the problem is here: .Take(ContentItemsPerLoop) when I removed this, the query retrieved about 2000 items but before I that, it executed twice and each time the query retrieved about 50 items.