Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8236477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:08:50+00:00 2026-06-07T19:08:50+00:00

I am creating a simple search function for my website using MySQL and PHP.

  • 0

I am creating a simple search function for my website using MySQL and PHP. Right now, if type the word “cat” into the search bar, I will NOT be able to retrieve articles with the word “cats”, and vice-versa. It is the same with the ending “ed”.

The only way that I can think of to solve this problem is by removing all “s” and “ed” from the end of each word that is longer than a certain length (to avoid turning “Ted” into “T”, etc). However, this simple solution is nowhere near perfect. I’m hoping someone can provide me with a better solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T19:08:51+00:00Added an answer on June 7, 2026 at 7:08 pm

    The technique you are referring to is called stemming. Because of the great many influences on languages this is a difficult thing to handle on your own at the application level. If you do not want to deal with this you can let MySQL do the heavy lifting for you depending on what version of MySQL you are running. If you are on version 5.6.4 or later it is built into the full-text search mechanism for both MyISAM tables and InnoDB tables. In versions 5.5 through 5.6.3 it is built in for MyISAM but not InnoDB tables. For version 5.1 there is a plugin available from mnoGoSearch. Prior to 5.1 I think you need to handle it at the application level but I have not confirmed that.

    These links might help get you started.

    • http://dev.mysql.com/doc/refman/5.6/en/glossary.html#glos_stemming
    • http://dev.mysql.com/doc/refman/5.6/en/glossary.html#glos_full_text_search
    • http://dev.mysql.com/doc/refman/5.6/en/glossary.html#glos_fulltext_index
    • http://dev.mysql.com/doc/refman/5.6/en/fulltext-search.html

    Be aware of the stopword list which is a list of very common and often short words that are ignored in your search text when the query is processed. There are settings to control the stopword list if it is preventing you from getting expected results. You will likely want to set the minimum word length to 2 or 3 (default is 4) and remove many of the words on the default list.

    If you do want to handle stemming on your own or with PHP there is a detailed technical discussion of the Porter Stemming Algorithm by Martin Porter and there are at least two PHP implementations available, an older one in PHP4 by Jon Abernathy that may have some flaws and a newer one in PHP5 by Richard Heyes.

    I am assuming that you are primarily concerned with English but I believe that there is some support for other languages as well.

    As mentioned by rnmccall if you need more advanced search capabilities you may need to go with Sphinx or Apache Lucene.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a search function of my classifieds on my website. Here is
I am creating a property search/ comparison website. I require help creating the mysql
Simple search engine issues.. I'm creating a simple search engine but i'm not able
Seems simple enough. I'm creating a search engine that returns results to the user
Creating a simple RPG game, first time using XNA. Trying to get my character
I'm creating a simple color picker controlled by a custom slider type control. I'm
I'm creating a page search function and I need to compare the contents of
I am creating a simple Prism 2.1 demo that uses the 'directory search' approach
I am creating a simple search query. I'd like to select a column that
I am creating a simple search feature that queries a user input string for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.