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 4106464
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:22:49+00:00 2026-05-20T21:22:49+00:00

EDIT: As can be seen, I decided to go with mySQL’s Match. That said,

  • 0

EDIT: As can be seen, I decided to go with mySQL’s “Match”. That said, if someone knows of a clean method to do what I wanted within a SELECT statement, I would appreciate the information (knowledge for knowledge sake and all that)

I’m currently working on developing a local search engine for a website I’m designing, and as such one way in which I am using to determine the relevance of articles is the number of times the search terms appear in the article itself. As such, I’m looking for an SQL query that will allow me to pull rows (articles) containing the search term, and than order them based on how many times the search terms appear in each row (articles).

In other words, I need something like this…

SELECT article_id FROM articles_table WHERE article_content LIKE '%Search Terms%' ORDER BY COUNT(number of times string appears in article_content);

So if a user were to search for “The Empire” and pulled up the following three articles…

  1. The Empire is The Empire.
  2. The Empire is the name of a position in baseball.
  3. The Empire The Empire The Empire.

It would sort them as so..

  1. The Empire The Empire The Empire
  2. The Empire is The Empire
  3. The Empire is the name of a position in baseball.

I am working in PHP, and although ideally I would like to perform this operation with nothing more then one SQL query, I’m open to PHP solutions if this is not possible.

Any and all help is greatly appreciated.

  • 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-05-20T21:22:49+00:00Added an answer on May 20, 2026 at 9:22 pm

    You should really consider a Full Text search solution. Either use MyISAM tables and MySQL native full text search, or you can go the external way and use something like Sphinx fulltext search or Lucene

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

Sidebar

Related Questions

Are there any editors that can edit multi-gigabyte text files, perhaps by only loading
I have a controller method called Edit in which the user can edit data
EDIT : What happens can be seen in this page when the height resolution
EDIT: It seems that I can only make 2 posts per day. If I
Edit: You can get the full source here: http://pastebin.com/m26693 Edit again: I added some
Edit: We can close. Isn't truly asynchronous, non-blocking javascript impossible? var PATH = require
EDIT: You can see the search box live here . Before I explain, let
Edit: I can use Actionscript 3.0 and/or Java I have a bit of a
Is there a tool where you can edit a .NET dll directly? .net reflector
In the below code onclick edit how can the value of tag test be

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.