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

The Archive Base Latest Questions

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

I am trying to implement a search algorithm in my simple datastructure. However, this

  • 0

I am trying to implement a search algorithm in my simple datastructure. However, this is not a “HOW DO I DO THIS?”-question, but rather a “how could i optimize the algorithm?”

I am trying to keep a index of files, and each file can be associated with any number of tags (which acts like a category)

This is how my data is structured:

Entries:

 ------------------------------------
|  id  | description | short | score | 
 ------------------------------------

Tags:

 -------------
|  id  | text |
 -------------

EntryTags:

 -------------------
| entry_id | tag_id |
 -------------------

In the search field, the search request, will always be turned into single words split apart with a plus (+).

in the following example i will be searching for “blue+website+simple+layout”

- split searchterm up into array named t
- convert each word in array t into a number using the id from "Tags" table
- for each element in array t, select make new array for each element with "EntryTags" matching the search
- generate array A, where elements that are in all 4 arrays are put into
- generate array B, where elements that are in 3 of the 4 arrays are put into
- generate array C, where elements that are in 2 of the 4 arrays are put into
- generate array D with the last elemenets rest
- sort array A,B,C and D by the score parameter from the table
- output array A, then B, then C, then D

ofcourse this is not optimized or anything, but my lack of experience with more complex SQL is kicking my butt 🙁

In the end, all of this will be written in PHP and the mysqli library (and i will ofcourse keep the thread updated as i progress further)

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

    You could use a kind of Bloom filter (at least this is part of Google’s strategy). First you look up for entries with all of the entered tags. If you find nothing, try out all combinations with one tag missing, then with two tags missing … until you have enough matches. The lookup in the Bloom filter is very fast, so it’s okay to do many lookups.

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

Sidebar

Related Questions

I'm trying to implement a search for my project , but i can't figure
I'm still trying to implement a search function into my Android app. So far
So I am trying to implement a search bar in my app and am
I'm trying to implement a multi threaded, recursive file search logic in Visual C++.
I am trying to implement this function which works everywhere except every IE version
I try to learn and implement a simple genetic algorithm library for my project.
I'm trying to implement a Widget control that exists on every page in the
I'm trying to add a search box to a master page in an ASP.Net
I am trying to implement LRU Cache using C++ . I would like to
Hi I'm trying to implement jquery token input according to railscasts #258 http://railscasts.com/episodes/258-token-fields Where

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.