ProgrammingNot sure how to tackle this any help would be appreciated
Posted:

ProgrammingNot sure how to tackle this any help would be appreciatedPosted:

Large
  • E3 2016
Status: Offline
Joined: Jun 03, 201011 Year Member
Posts: 2,874
Reputation Power: 3633
Status: Offline
Joined: Jun 03, 201011 Year Member
Posts: 2,874
Reputation Power: 3633
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:
Craig
  • Discord Elite
Status: Offline
Joined: Jan 16, 20129 Year Member
Posts: 20,244
Reputation Power: 17012
Motto: 2b || !2b
Motto: 2b || !2b
Status: Offline
Joined: Jan 16, 20129 Year Member
Posts: 20,244
Reputation Power: 17012
Motto: 2b || !2b
Depends what language you're using, but a foreach loop will be able to accomplish this easily.
#3. Posted:
CriticaI
  • 2 Million
Status: Offline
Joined: Nov 05, 20137 Year Member
Posts: 2,715
Reputation Power: 156
Status: Offline
Joined: Nov 05, 20137 Year Member
Posts: 2,715
Reputation Power: 156
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.
#4. Posted:
16
  • Fairy Master
Status: Offline
Joined: Nov 24, 20137 Year Member
Posts: 3,486
Reputation Power: 10520
Status: Offline
Joined: Nov 24, 20137 Year Member
Posts: 3,486
Reputation Power: 10520
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.
Users browsing this topic: None
Jump to:


RECENT POSTS

HOT TOPICS