This project is read-only.

Customization in Search

Topics: Customizing Orchard
Jul 8, 2013 at 9:00 AM

I am new to Orchard 1.6. In my project I need to develop a search for site which should include data from my content type with normal search result which search module will provide.

I am having Resource library as my content type. Now I need to show data from this content type in search result with some gating functionality.

Please suggest how can I customize search result.
Jul 9, 2013 at 1:52 PM
Hi Team,

To add my Resource Library content type's data in search result, I have check "Index this content type for search" for my content type. In Search Index setting page index document size get increased. But still in actual search I am not getting records from this content type.

Is any other setting I have missed out. Please suggest.
Jul 10, 2013 at 6:44 AM
Yes, under settings/search, check that everything that needs to be checked is checked.
Jul 11, 2013 at 2:05 PM
Hi BertrandLeRoy,

I tried with this option but still no records, from my content type are shown in result.
Jul 11, 2013 at 6:59 PM
This should work, so you must be doing something a little different. Please provide the exact steps to reproduce on a vanilla Orchard site.
Jul 12, 2013 at 10:30 AM
Hi BertrandLeRoy,

Below are the exact steps which I follow
  1. In my project need to show resources so that I have created one content type named as "Resource Library". Which contains Title, Description, DocPath etc fields.
  2. Admin user will add these data and I will show these data on UI.
  3. Now I need to include Search in site. I have enable Search feature in site and add Search Form in my widget.
  4. I have then used this forum and add Title and Description fields(fields from Resource Library) in Search fields on Settings => Search.
  5. In Settings/Search page select all check box including Title and Description which I have added in step 5.
  6. n Settings => Search Index page, Then rebuild search index. Now it is below message o
    The search index contains 138 document(s).
    The search index contains the following fields: id, body, format, type, author, created, published, modified, title, Title, Description.
    The search index was last updated 32 seconds ago.
  7. Now on my search page i tried to search data from resource library content type and it is not showing in search result.
Jul 12, 2013 at 6:10 PM
Did you also enable Lucene and Indexing?
Jul 13, 2013 at 8:32 AM
Yes, I did enable these module after when I enable Search module.
Jul 23, 2013 at 9:05 AM

I have used this post to resolve my problem.

Previously I was using

OnIndexing<ResourceLibraryPart>((context, part) => context.DocumentIndex.Add("Title", part.Title).Store()); in my handler file instead of

OnIndexing<ResourceLibraryPart>((context, part) => context.DocumentIndex.Add("Title", part.Title).RemoveTags().Analyze().Store());

What I was missing is .RemoveTags().Analyze()