简体   繁体   中英

Custom Search Engine Which Searches a Private Database

I am looking for a search engine that can search through a MySQL database and return results in a similar way to Google search. For an example of what I am looking for you can check out

http://historio.us and http://saveandsearch.com/

Both these apps allow you to save websites to your own personal database and then search through them later. It is like a personal Google search engine that you can fill with only the sites you like. So instead of searching the whole web it only searches through sites you have added to its database.

Is there some sort of open source search engine that I can use as a starting point?

The search engine you are looking here is just database. You insert data to DB, and then search it by userid and keyword. It's nothing more complex than that.

I give you an example (just the some pointers, SQL's). User login to your system, and gets userid 7, then he enters new site "www.newsite.com", you enter this to your DB.

insert into sites (id,sitename) values (site_new_id, 'www.newsite.com');
insert into user_sites(userid,siteid) values (7,site_new_id);

Now next the hard part, you somehow need to know what are the keywords of the site. There you have to do some research, how to do it, maybe someone knows ready-made module (maybe that was what you were actually asking). Somehow check keywords (use cURL or something). Record those keywords to table, and link those keywords to site.

insert into keywords(id,keyword) values (keyword_new_id,'awesome');
insert into keywords(id,keyword) values (keyword_new_id2,'software');
insert into keywords(id,keyword) values (keyword_new_id3,'here');

insert into site_keywords(siteid,keywordid) values (site_new_id,keyword_new_id);
... etc

Now after user login again and search with keyword 'awesome'. You do your query:

SELECT sitename 
  FROM sites s, keywords k, site_keywords sk, user u
 WHERE k.keyword = 'awesome' AND k.id=sk.keywordid AND sk.siteid=s.id
   AND u.site_id = s.id AND u.id = 7

Something like that. Now it occurred to my mind, that you asked source for such engine and I dont know that, ehh, sorry. But you can build one of your own by using these tips :/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM