은 그것을 개발하는 것이 가능하다는 강력한 웹 검색 엔진을 사용하여 얼랑,Mnesia&딸기 종?

StackOverflow https://stackoverflow.com/questions/195809

문제

나는 생각하고 개발하는 웹 검색 엔진을 사용하여 얼랑,Mnesia&딸기 종.그것은 가능한 강력한과 가장 빠른 웹 검색 엔진을 사용하여 이러한 소프트웨어입니까?그것은 무엇이 필요 이것을 달성하는 방법과 나는 무엇을 시작으로?

도움이 되었습니까?

해결책

패키지 할 수 있는 가장 강력한 웹 크롤러 오늘입니다.나를 통해 당신을 데려 갈 나의 간단한 크롤러입니다.

단계 1.내가 만드 간단한 병렬 처리 모듈,which i call mapreduce

-module(mapreduce).
-export([compute/2]).
%%=====================================================================
%% usage example
%% Module = string
%% Function = tokens
%% List_of_arg_lists = [["file\r\nfile","\r\n"],["muzaaya_joshua","_"]]
%% Ans = [["file","file"],["muzaaya","joshua"]]
%% Job being done by two processes
%% i.e no. of processes spawned = length(List_of_arg_lists)

compute({Module,Function},List_of_arg_lists)->
    S = self(),
    Ref = erlang:make_ref(),
    PJob = fun(Arg_list) -> erlang:apply(Module,Function,Arg_list) end,
    Spawn_job = fun(Arg_list) -> 
                    spawn(fun() -> execute(S,Ref,PJob,Arg_list) end)
                end,
    lists:foreach(Spawn_job,List_of_arg_lists),
    gather(length(List_of_arg_lists),Ref,[]).
gather(0, _, L) -> L; gather(N, Ref, L) -> receive {Ref,{'EXIT',_}} -> gather(N-1,Ref,L); {Ref, Result} -> gather(N-1, Ref, [Result|L]) end.
execute(Parent,Ref,Fun,Arg)-> Parent ! {Ref,(catch Fun(Arg))}.

단계 2. HTTP 클라이언트

하나는 일반적으로 사용하거나 inets httpc module 내장으로 얼랑이나 ibrowse.그러나 메모리 관리 및 속도(받고 메모리를 발로 인쇄 가능한한 낮),좋은 얼랑 프로그래머는 것을 선택 사용 .을 적용하여 os:cmd/1 는 것 컬 명령행,하나은 출력이 직접적으로 얼랑 호출하는 기능입니다.아직,그것의 더 나은 만들기 위해,컬 던져에 출력으로 파일은 그리고 우리의 다른 스레드 응용 프로그램(process)을 읽고 분석한 파일

명령: curl "http://www.erlang.org" -o "/downloaded_sites/erlang/file1.html"
에 얼랑
os:cmd("curl \"http://www.erlang.org\" -o \"/downloaded_sites/erlang/file1.html\"").
할 수 있도록 생성은 많은 프로세스입니다.당신은 기억을 탈출한 URL 뿐만 아니라 출력 파일의 경로를 실행하는 명령입니다.프로세스에서 다른 손으로 그의 작품은 디렉토리의 다운로드 페이지입니다.이러한 페이지를 읽고 분석할 수 있습 그 후 삭제 분석 또는 저장을 다른 위치에서 또는 더 나은,아카이브를 사용하여 zip module
folder_check()->
    spawn(fun() -> check_and_report() end),
    ok.

-define(CHECK_INTERVAL,5).

check_and_report()->
    %% avoid using
    %% filelib:list_dir/1
    %% if files are many, memory !!!
    case os:cmd("ls | wc -l") of
        "0\n" -> ok;
        "0" -> ok;
        _ -> ?MODULE:new_files_found()
    end,
    sleep(timer:seconds(?CHECK_INTERVAL)),
    %% keep checking
    check_and_report().

new_files_found()->
    %% inform our parser to pick files
    %% once it parses a file, it has to 
    %% delete it or save it some
    %% where else
    gen_server:cast(?MODULE,files_detected).

단계 3. Html parser.
더 나은 사용 mochiweb 의 html 파서 및 XPATH.이 도움이 될 것입니다 당신 분석을 얻을 좋아하는 모든 HTML 태그 내용을 추출한 다음 갈 수 있습니다.아래 예에 초점을 맞추었만 Keywords, descriptiontitle 태그


모듈 테스트에는 셸...최고 결과!!!

2> spider_bot:parse_url("http://erlang.org").
[[[],[],
  {"keywords",
   "erlang, functional, programming, fault-tolerant, distributed, multi-platform, portable, software, multi-core, smp, concurrency "},
  {"description","open-source erlang official website"}],
 {title,"erlang programming language, official website"}]

3> spider_bot:parse_url("http://facebook.com").
[[{"description",
   " facebook is a social utility that connects people with friends and others who work, study and live around them. people use facebook to keep up with friends, upload an unlimited number of photos, post links
 and videos, and learn more about the people they meet."},
  {"robots","noodp,noydir"},
    [],[],[],[]],
 {title,"incompatible browser | facebook"}]

4> spider_bot:parse_url("http://python.org").
[[{"description",
   "      home page for python, an interpreted, interactive, object-oriented, extensible\n      programming language. it provides an extraordinary combination of clarity and\n      versatility, and is free and
comprehensively ported."},
  {"keywords",
   "python programming language object oriented web free source"},
  []],
 {title,"python programming language – official website"}]

5> spider_bot:parse_url("http://www.house.gov/").
[[[],[],[],
  {"description",
   "home page of the united states house of representatives"},
  {"description",
   "home page of the united states house of representatives"},
  [],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],
  [],[],[]|...],
 {title,"united states house of representatives, 111th congress, 2nd session"}]


할 수 있습을 실현하는 우리의 인덱스로 사용할 수 있습 페이지에 대한 자신의 키워드로,플러스 좋은 일정 페이지의 revisists.또 다른 도전이었는 방법을 확인 크롤러(무언가를 이동할 것입니다 주위에 전체 웹에서 도메인을 도메인)지만,그 중 하나는 것은 쉽습니다.그하여 가능한 구문 분석에 Html 파일에 대한 href 태그가 있습니다.HTML 파서 추출한 모든 href 태그와 그런 다음 필요할 수 있는 몇 가지 일반적인 식 여기 저기를 얻 링크 오른쪽 아래에 주어진 도메인이 있습니다.

실행하는 크롤러

7> spider_connect:conn2("http://erlang.org").        

        Links: ["http://www.erlang.org/index.html",
                "http://www.erlang.org/rss.xml",
                "http://erlang.org/index.html","http://erlang.org/about.html",
                "http://erlang.org/download.html",
                "http://erlang.org/links.html","http://erlang.org/faq.html",
                "http://erlang.org/eep.html",
                "http://erlang.org/starting.html",
                "http://erlang.org/doc.html",
                "http://erlang.org/examples.html",
                "http://erlang.org/user.html",
                "http://erlang.org/mirrors.html",
                "http://www.pragprog.com/titles/jaerlang/programming-erlang",
                "http://oreilly.com/catalog/9780596518189",
                "http://erlang.org/download.html",
                "http://www.erlang-factory.com/conference/ErlangUserConference2010/speakers",
                "http://erlang.org/download/otp_src_R14B.readme",
                "http://erlang.org/download.html",
                "https://www.erlang-factory.com/conference/ErlangUserConference2010/register",
                "http://www.erlang-factory.com/conference/ErlangUserConference2010/submit_talk",
                "http://www.erlang.org/workshop/2010/",
                "http://erlangcamp.com","http://manning.com/logan",
                "http://erlangcamp.com","http://twitter.com/erlangcamp",
                "http://www.erlang-factory.com/conference/London2010/speakers/joearmstrong/",
                "http://www.erlang-factory.com/conference/London2010/speakers/RobertVirding/",
                "http://www.erlang-factory.com/conference/London2010/speakers/MartinOdersky/",
                "http://www.erlang-factory.com/",
                "http://erlang.org/download/otp_src_R14A.readme",
                "http://erlang.org/download.html",
                "http://www.erlang-factory.com/conference/London2010",
                "http://github.com/erlang/otp",
                "http://erlang.org/download.html",
                "http://erlang.org/doc/man/erl_nif.html",
                "http://github.com/erlang/otp",
                "http://erlang.org/download.html",
                "http://www.erlang-factory.com/conference/ErlangUserConference2009",
                "http://erlang.org/doc/efficiency_guide/drivers.html",
                "http://erlang.org/download.html",
                "http://erlang.org/workshop/2009/index.html",
                "http://groups.google.com/group/erlang-programming",
                "http://www.erlang.org/eeps/eep-0010.html",
                "http://erlang.org/download/otp_src_R13B.readme",
                "http://erlang.org/download.html",
                "http://oreilly.com/catalog/9780596518189",
                "http://www.erlang-factory.com",
                "http://www.manning.com/logan",
                "http://www.erlang.se/euc/08/index.html",
                "http://erlang.org/download/otp_src_R12B-5.readme",
                "http://erlang.org/download.html",
                "http://erlang.org/workshop/2008/index.html",
                "http://www.erlang-exchange.com",
                "http://erlang.org/doc/highlights.html",
                "http://www.erlang.se/euc/07/",
                "http://www.erlang.se/workshop/2007/",
                "http://erlang.org/eep.html",
                "http://erlang.org/download/otp_src_R11B-5.readme",
                "http://pragmaticprogrammer.com/titles/jaerlang/index.html",
                "http://erlang.org/project/test_server",
                "http://erlang.org/download-stats/",
                "http://erlang.org/user.html#smtp_client-1.0",
                "http://erlang.org/user.html#xmlrpc-1.13",
                "http://erlang.org/EPLICENSE",
                "http://erlang.org/project/megaco/",
                "http://www.erlang-consulting.com/training_fs.html",
                "http://erlang.org/old_news.html"]
ok
저장소: 은 하나의 가장 중요한 개념들을 검색 엔진입니다.그것의 큰 실수를 저장하는 검색 엔진 데이터 RDBMS 다음과 같 MySQL,Oracle,MS SQL e.t.c.이러한 시스템은 완전히 복잡하고는 응용 프로그램과 인터페이스들을 휴리스틱을 사용 알고리즘이 있습니다.이것은 우리에게 키 값을 저장, 있는 두 개의 베 소파베이스 서버Riak.이들은 위대한 클라우드 파일 시스템입니다.또 다른 중요한 매개 변수를 캐싱이 가능합니다.캐싱을 획득하여 말 Memcached, 는 다른 두 개의 스토리지 시스템 위에서 언급에 대한 지원을 하고 있습니다.스토리지 시스템을 검색 엔진을 위한 해야하는 schemaless DBMS에 초점을 맞춘 Availability rather than Consistency.자세히보기 검색 엔진에서 여기: http://en.wikipedia.org/wiki/Web_search_engine

다른 팁

내가 아는 한 PowerSetErlang을 사용하여 자연 언어 프로세스 검색 엔진이 개발되었습니다.

당신은 봤어? couchdb (Erlang에도 작성된 것은)가 몇 가지 문제를 해결하는 데 도움이되는 도구로?

나는 Mnesia 대신 CouchDB를 추천합니다.

  • MNESIA는 MAP -REDUCE가 없습니다. CouchDB는 (수정 - 의견 참조)
  • MNESIA는 정적으로 입력하고 CouchDB는 문서 데이터베이스입니다 (그리고 페이지는 문서입니다. 즉, 내 의견으로는 정보 모델에 더 잘 맞습니다).
  • MNESIA는 주로 메모리 주거 데이터베이스입니다

yaws는 꽤 좋습니다. Mochiweb도 고려해야합니다.

당신은 Erlang에게 잘못되지 않을 것입니다

에서 'RDBMS'기여, Porter Stemming 알고리즘의 구현이 있습니다. 그것은 결코 'rdbms'에 통합되지 않았으므로 기본적으로 거기에 앉아 있습니다. 우리는 내부적으로 그것을 사용했으며 적어도 크지 않은 데이터 세트에 대해 잘 작동했습니다 (엄청난 데이터 볼륨에서 테스트하지 않았습니다).

관련 모듈은 다음과 같습니다.

rdbms_wsearch.erl
rdbms_wsearch_idx.erl
rdbms_wsearch_porter.erl

물론 디스코 맵-레지 두 프레임 워크.

당신이 가장 빠른 엔진을 만들 수 있는지 여부는 말할 수 없었습니다. a 더 빠르게 검색 엔진? 나는 Google의 속도에 문제가 없었습니다. 그러나 내 질문에 대한 좋은 답변을 찾을 가능성을 높이는 검색 시설이 저에게 관심을 가질 것입니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top