ProgrammingNot sure how to tackle this any help would be appreciated
Status: Offline
Joined: Jun 03, 201014Year Member
Posts: 2,900
Reputation Power: 3713
Status: Offline
Joined: Jun 03, 201014Year Member
Posts: 2,900
Reputation Power: 3713
I am trying to design a search system that uses a string of characters to bring back a list of search results...
Example user enters 123456 into the search bar on the back end the 123456 references an ID The ID references a list of associated results How would I go about doing this? |
#2. Posted:
Status: Offline
Joined: Jan 16, 201212Year Member
Posts: 20,271
Reputation Power: 17066
Motto: 2b || !2b
Motto: 2b || !2b
Status: Offline
Joined: Jan 16, 201212Year Member
Posts: 20,271
Reputation Power: 17066
Motto: 2b || !2b
Depends what language you're using, but a foreach loop will be able to accomplish this easily. |
- 0useful
- 0not useful
#3. Posted:
Status: Offline
Joined: Nov 05, 201311Year Member
Posts: 2,753
Reputation Power: 452
Status: Offline
Joined: Nov 05, 201311Year Member
Posts: 2,753
Reputation Power: 452
You can make this as complicated as you want. For general purposes, you can send the user's input to the server. Then sanitize by doing something like parseInt.
If you really want to be safe, you could write a lexer/parser to make sure no invalid inputs are submitted. This is how Twitter's search works. Special characters could be used to run commands like search for posts vs searching for users. |
- 0useful
- 0not useful
#4. Posted:
Status: Offline
Joined: Nov 24, 201311Year Member
Posts: 3,683
Reputation Power: 12024
Status: Offline
Joined: Nov 24, 201311Year Member
Posts: 3,683
Reputation Power: 12024
parse the data through the backend/DB and display results. There are a few ways to go about this but primarily API calling is what you're going to focus on. |
- 0useful
- 0not useful
Users browsing this topic: None