Author |
Topic: Database Search (Read 8743 times) |
|
mad
Junior Member
Posts: 118
|
|
Database Search
« on: Feb 5th, 2008, 5:56am » |
Quote Modify
|
How do you search for a word in a large database? Suggest efficient data structures, algorithms or indices for the same.
|
|
IP Logged |
|
|
|
Grimbal
wu::riddles Moderator Uberpuzzler
Gender:
Posts: 7527
|
|
Re: Database Search
« Reply #1 on: Feb 5th, 2008, 6:13am » |
Quote Modify
|
Is the question like: how to implement a database? What kind of database is it? Is it like a dictionary and you search the definition of a word, or is it like a documents database and you search where the word appears?
|
|
IP Logged |
|
|
|
mad
Junior Member
Posts: 118
|
|
Re: Database Search
« Reply #2 on: Feb 6th, 2008, 9:53am » |
Quote Modify
|
Say it is a database of documents and you search where the word appears
|
|
IP Logged |
|
|
|
Grimbal
wu::riddles Moderator Uberpuzzler
Gender:
Posts: 7527
|
|
Re: Database Search
« Reply #3 on: Feb 6th, 2008, 10:08am » |
Quote Modify
|
Create for each word the list of documents where it appears. It is quite easy. Create one file for each word. The file being conveniently named after the file. Parse all the documents, and every time you find a word you write the name of the document in the file. Well, maybe you should first remove duplicates from the document. So: for each document, parse the document and store a list of unique words in a hash table. Then, for each word, append the ID fo the document at the end of the file named after the word. Create the files as necessary.
|
« Last Edit: Feb 6th, 2008, 10:09am by Grimbal » |
IP Logged |
|
|
|
iatkrox
Newbie
Gender:
Posts: 45
|
|
Re: Database Search
« Reply #4 on: Jul 2nd, 2012, 9:49am » |
Quote Modify
|
Make a search bot !!! Then he will do the work for you
|
|
IP Logged |
|
|
|
kylajams
Newbie
Posts: 2
|
|
Re: Database Search
« Reply #5 on: Aug 27th, 2012, 3:35am » |
Quote Modify
|
Even I wish to know the answer.
|
|
IP Logged |
|
|
|
kentonson
Newbie
Posts: 1
|
|
Re: Database Search
« Reply #6 on: Nov 7th, 2012, 8:11am » |
Quote Modify
|
Any new algorithm for searching I wish to know well ...
|
|
IP Logged |
|
|
|
cartoonle
Junior Member
Gender:
Posts: 56
|
|
Re: Database Search
« Reply #7 on: Dec 13th, 2012, 4:01am » |
Quote Modify
|
You should build a inverted index like search engines do. The best for this job are NoSQL databases like Big table from Google.
|
|
IP Logged |
friv - something i've built
|
|
|
webtasarim
Newbie
Gender:
Posts: 47
|
|
Re: Database Search
« Reply #8 on: Oct 6th, 2013, 4:40pm » |
Quote Modify
|
i m gonna use simple words
|
|
IP Logged |
|
|
|
pratisaad
Newbie
Posts: 1
|
|
Re: Database Search
« Reply #9 on: Oct 10th, 2013, 5:17am » |
Quote Modify
|
Microsoft SQL is the good database for security purpose.
|
|
IP Logged |
|
|
|
Grimbal
wu::riddles Moderator Uberpuzzler
Gender:
Posts: 7527
|
|
Re: Database Search
« Reply #11 on: Oct 10th, 2013, 3:07pm » |
Quote Modify
|
Yeah, but if it's Microsoft who asks at a job interview...
|
« Last Edit: Oct 10th, 2013, 3:07pm by Grimbal » |
IP Logged |
|
|
|
webtasarim
Newbie
Gender:
Posts: 47
|
|
Re: Database Search
« Reply #12 on: Oct 21st, 2013, 3:42am » |
Quote Modify
|
binary search algorithm can be the best one . In computer science, a binary search or half-interval search algorithm finds the position of a specified input value (the search "key") within an array sorted by key value.[1][2] In each step, the algorithm compares the search key value with the key value of the middle element of the array. If the keys match, then a matching element has been found and its index, or position, is returned. Otherwise, if the search key is less than the middle element's key, then the algorithm repeats its action on the sub-array to the left of the middle element or, if the search key is greater, on the sub-array to the right. If the remaining array to be searched is empty, then the key cannot be found in the array and a special "not found" indication is returned. A binary search halves the number of items to check with each iteration, so locating an item (or determining its absence) takes logarithmic time. A binary search is a dichotomic divide and conquer search algorithm. source : wikipedia.org
|
|
IP Logged |
|
|
|
Grimbal
wu::riddles Moderator Uberpuzzler
Gender:
Posts: 7527
|
|
Re: Database Search
« Reply #13 on: Oct 21st, 2013, 4:35am » |
Quote Modify
|
Binary search is useless in locating occurences of a word in a set of documents.
|
|
IP Logged |
|
|
|
|