doulangxun7769 2012-04-03 06:44
浏览 52

搜索私有数据库的自定义搜索引擎

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?

  • 写回答

1条回答 默认 最新

  • doucang8303 2012-04-03 06:53
    关注

    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 :/

    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?