Support » Plugin: Relevanssi - A Better Search » [Plugin: Relevanssi – A Better Search] Restrict search to post titles only?

  • Resolved Jaya


    My website relies on the search feature a lot and I would like to restrict that to post titles only as that’s all what matters to my website’s users.

    Is this doable? Would that lower the memory usage in my server?

    Any help would be appreciated! Thank you in advance for such an amazing plugin!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Mikko Saari


    I just did that for another user of Relevanssi. Here’s a function that’ll make post body count less: Making post body not count. Small adjustment to that will make only titles count. Using that function will require the Premium version of Relevanssi, though.

    Of course to take it a bit further, one would need to prevent the indexing of anything but the titles. That isn’t currently possible without hacking the source code, but adding filters to make it possible is on my list of things to do.

    Thank you for your quick response! I’ll be watching the plugin’s updates and might invest on the premium version once this has been added.

    Have a wonderful day!

    Plugin Author Mikko Saari


    Hi, I just released the version 1.5.5 of Relevanssi Premium, which includes the necessary filters. Not including post content makes the search database much leaner and should make things easier on server memory and processor.

    Plugin Author Mikko Saari


    I’m probably not going to add this feature to the free version, but it’s fairly easy to hack if you want it and don’t mind making the changes every time you update. Here’s how:

    In relevanssi_index_doc() function, find this line:

    $contents = relevanssi_tokenize($contents);

    and replace it with

    $contents = array();

    That’ll prevent Relevanssi from tokenizing and indexing post content.

    That code worked great! Thank you!

    what’s the difference between the premium version’s implementation and the code you posted?

    Appreciate your support!

    Plugin Author Mikko Saari


    The Premium version has a filter that can be turned on and off without changing the code. This will be overwritten when you upgrade, the premium version lets you do the change outside Relevanssi code.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Relevanssi – A Better Search] Restrict search to post titles only?’ is closed to new replies.