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

  • Home
  • SEARCH
  • 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 7712035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:31:40+00:00 2026-06-01T01:31:40+00:00

I have a JSON object containing a number of strings. I also have a

  • 0

I have a JSON object containing a number of strings. I also have a match string . Now I wish to arrange the object of strings on the basis of how closely (more) they match with match string.

How this can be done using Javascript.

Suppose, I searched for Philips SHM6110U Headphone

Search will then fetch following result.

[
    {
        "position": 12,
        "link": "http:\/\/www.talash.com\/buy-online-philips-shl5001-hi-fi-headphone-headband-headphone-india-product.html",
        "image": "http:\/\/staticus.talash.com\/product_images\/p\/092\/DM1573_1lg__52708_thumb.jpg",
        "prod": "Philips Shl5001 Hi Fi Headphone Headband Headphone",
        "price": "Rs. 1000"
    },
    {
        "position": 12,
        "link": "http:\/\/www.talash.com\/buy-online-philips-shl5000-hi-fi-headphone-headband-headphone-india-product.html",
        "image": "http:\/\/staticus.talash.com\/product_images\/n\/497\/DM1572_1lg__57945_thumb.jpg",
        "prod": "Philips Shl5000 Hi Fi Headphone Headband Headphone",
        "price": "Rs. 1030"
    }
]​

Now, I have to sort them according to the match string “Philips SHM6110U Headphone” and the prod value of JSON.

Suggesting an algorithm or sample source code will do!

  • 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-01T01:31:42+00:00Added an answer on June 1, 2026 at 1:31 am

    I do it finally using a number of criteria :-

    1. Individual word matching of the search result and search query
    2. Extra credits for complete matching of result and search query
    3. Portion of length of all words matching to the total length of search result
    4. Extra credits if the search query appears at an index less than half of the total length of search result
    5. A price filter for further improvements in result.

    Here is the final result

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

Sidebar

Related Questions

I have a session variable $_SESSION[animals] containing a deep json object with values: $_SESSION[animals]='{
I have several string each containing a JSON representation of an array of objects.
I have a php string containing the serialization of a javascript object : $string
I have a server at http://foobar that returns a JSON object containing information about
I have a json object in my JavaScript file containing qs: {} which when
I have a big json object containing cell data from a sample spreadsheet that
I have an AJAX-request that returns a json object containing a few values with
I have a JSON object of data containing items and their sales listed by
I have a server side Python script that returns a JSON string containing parameters
I have a webservice ( RestEasy ) returning a JSON object containing a List<..>

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.