How to enable search feature in Orchard CMS 1.7.2.0

Hi Guys,

Today’s topic is on,

How to enable search feature in Orchard CMS 1.7.2.0!

Most of the web developers who were/are working on Orchard must be shocked to believe that “search feature in Orchard CMS” is by default “Off” and tell that orchard framework search not working or guessing how to enable search in orchard cms. But, not to worry – Search functionality is just turned off by default and will get an error “Please define a default search index“. That doesn’t say – search feature is not available on Orchard CMS.

What you will learn in this tutorial?

1. To enable search feature in orchard cms

2. To add a search box onto your website front-end

I myself wondered how to get this stuff done! That’s when I saw some of the screenshots on this post “Creating-custom-content-types“. Where-in, I saw that there was a “Check-box” field under  every display name for every content type created.

It says:
[Checkbox] Index this content type for search

But, that particular line didn’t appear with a check-box in any of the content types when I installed Orchard CMS. See below – I have circled it in read.

Enable search feature in Orchard cms before creating index for custom content types - PepFry

Enable search feature in Orchard CMS before creating index for custom content types

Then, I thought of creating a field where it would ask the admin  to Check/tick the option of indexing any content type created or pre existed. However, you have to enable all the 3 modules including Indexing, Search and Lucene to achieve this as seen here in the Orchard documentation website.

Search feature in Orchard CMS

Can be achieved by enabling some modules that are freely available in the “Module section” of the Orchard CMS Dashboard. Follow all the below steps to enable search in your Orchard CMS.

By default you have to install/enable 3 modules:

Go to Dashboard -> Modules

  • Indexing
  • Search
  • Lucene

Since, there are many modules listed out – you can feel free to use the “Filter” feature provided. Just type the module name in the filter box and it will be picked up and shown to you. You have to just click on the enable link on the right top of every module.

 Indexing module:

 

Enable search feature in Orchard cms indexing module - PepFry

Enable search feature in Orchard CMS using – Indexing module

Search module:

Enable search feature in Orchard cms search module - PepFry

Enable search feature in Orchard CMS using – Search module

Lucene module:

Enable search feature in Orchard cms lucene module - PepFry

Enable search feature in Orchard CMS using – Lucene module

Its not yet over – we have still work to be done after this. This is where all the 3 installed modules take their roles.

What we have to do is – Just scroll down you admin dashboard, you will now see “Settings tab“. Click on the arrow located on the right side of the tab. Now you will see few more links have been added. Mainly the Indexes and Search. They were not listed previously before installing the above 3 modules. See below screen shot – I have circled them in read.

Enable search feature in Orchard CMS search and Indexes item appear in the settings tab - PepFry

Enable search feature in Orchard CMS – Search and Indexes item appear in the settings tab

What next?

  • 1
  • Click on the “Indexes” link and it will take you to the “Create Index” page. Where you will be able to create an Index to your content types. If you create one – It will be displayed below all of your content types for you to Check/tick so that the CMS includes that content type to search index.

    To be precise – When you create an Index here it will add this:

    [Checkbox] Index this content type for “My_Search

    Where,
    Checkbox - Is replaced with regular HTML input type checkbox
    My_Search - Is replaced by the name you give while creating a new Index

  • 2
  • Now click on the “Create” button

     

    Enable search feature in Orchard cms - Create new index - PepFry

    Enable search feature in Orchard CMS – Create new index

  • 3
  • Once you click on the create button, it will then take you to the index creation page – where you can name the new index that you are about to create. In this case, I’ll name it as “My_Search“.

    Enable search feature in Orchard cms create new index and providing title - PepFry

    Enable search feature in Orchard CMS – Create new index – Providing Title

    You should now see the success message!

    Enable search feature in Orchard cms indexes create new index success - PepFry

    Enable search feature in Orchard CMS – Create new index success message

    Now, you can see that the Checkbox has been displayed in the content types for you to select.

    Enable search feature in Orchard cms after creating search index for custom content types - PepFry

    Enable search feature in Orchard CMS – Creating search index for custom content types

Next process is  that – You have to go to each custom content type you want to get indexed by, clicking on the “Content definition” on the left side of the dashboard and then clicking on any of the content type listed out there and Check/tick the “Checkbox” that you see above.

So, guys – This is how you enable search feature in Orchard CMS!

Adding a search box to your website front-end

By default your website does not come with a search box on its front-end. You have to manually add one. Please follow my next tutorial on how to add a search box. Below is the link to the next tutorial.

If you are stuck up any where – please feel free to put your questions in the form of comments in the comments section below this post. So that, I can answer your questions.

11 thoughts on “How to enable search feature in Orchard CMS 1.7.2.0

  1. Hi, I’m trying to get this to work but I keep getting “Default field can’t be empty” error, do you have any idea how to remedy this? I see that fields can be defined in content definitions so I tried making a few but it doesn’t fix the error…

    • Hi Jesse,

      If you follow all the steps which I have listed out above – you should get your search function working. I think you should try from the start.
      Remove/delete everything you did for search and then follow my tutorial without missing even a single step.

      After this try – If you are still not able to get around it – get back to me.

      Thanks!
      Sumesh M.S

  2. Hi Sumesh,

    Firstly, This article helped a lot for such detailed steps on how to set up the search box and indexing.

    I followed all steps. I can see the search textbox and a button.

    My requirement is whenever a user types a keyword in the box and clicks search, if the keyword matches with the “tags” on any of the page then the page should be displayed in the search result.

    i have set up “tags” for content type page and in the “search” index mgmt, i have also selected field types as “tags”.

    Initially I was getting an error “page not found” when i click on the button, path: http://www.mysite.com/search?q=abcd. “abcd” is what i typed in the textbox. So i created a new page named it “search” and set the permalink as http://www.mysite.com/search.

    Now the page does open up, when i click on button, but it is always empty. No search results.

    If you can provide any inputs, it will be great help!

  3. Hi sumesh,
    I want to list the images in the search feature. Now I can only list titles, tags, descr… to the front end. How should I do this? Can u please help me?

    • Hi Devika,

      By default, if you have images in any of your pages or posts with alt text and title – they should be listed out when you search with those terms!
      Are you looking for something else?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">