哈尔滨工业大学分布式系统T15WebSearchTechnologies_第1页
哈尔滨工业大学分布式系统T15WebSearchTechnologies_第2页
哈尔滨工业大学分布式系统T15WebSearchTechnologies_第3页
哈尔滨工业大学分布式系统T15WebSearchTechnologies_第4页
哈尔滨工业大学分布式系统T15WebSearchTechnologies_第5页
已阅读5页,还剩31页未读, 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

DistributedSystemsWebSearchingTechnologiesSomehelpfulwebsites•Ahistoryofsearchengines:–/legacy/compbooks/sonnenreich/webdev/history.html•OpensourcesearchengineswritteninJava:–/open-source/search-engines•Robots:–/wc/robots.html2SearchEnginesArchitectureWebSpiderIndexerDatabaseUserQuerySearchInterfaceEngine3Spiders(WebCrawler)•AutomaticallyRetrievewebpages–StartwithanURL,retrievingthewebpage–FindallURLsonthewebpageandrecursivelyretrievenot-yetsearchedURLs•AlgorithmicIssues–EfficiencyandQuality:howtoquicklygatherasmanyusefulwebpagesaspossible?–HowtochoosethenextURL?–Howtoavoidoverloadedsub-networks?4Indexer•Selectterms(keywords)toindexadocument–needco-operationfromauthorsofwebpagethroughMetatags(nexttoTitletaginhtmlfiles)toindicatespecifictermstoindex<METAname="keywords"content=“retrieval,,cloudcomp”>•Algorithmicissues:–Howtochooseterms/phrasestoindexdocuments,suchthatuserqueriescanbereturnedaccuratelyandefficiently–Howtoindexdocumentsencodedindifferenttypes(multimediadataretrieval)5Database•Structureddata(seeBigtableforGoogle)–Bigtable:ADistributedStorageSystemforStructuredData,CACM,Jun2008••ParallelsearchanddistributedstorageAlgorithmicissues:–Datapartitioninganddistributedstorage:storepetabytesofdataacrossthousandsofservers–Real-timedataretrievalandupdate(shortlatency)–Fault-tolerance(dataredundancy)6SearchEngine••ReturnthemostrelevantdocumentsforqueriesAlgorithmicIssues:–Parallelsearch(e.g.,map-reducetechniques)–Relevanceanalysis7MajorProductsofSearchEngines••••••AltavistaGoogleGotoLycosYahoo…8SearchEngineSizes(Dec11,2001)Estimatedtotalwebpages~2billionAVFASTGGINKNLAltavistaFASTGoogleInktomiNorthernLightShadedareaforGGandINKTOMIarepagesindexedbutnotvisitedSOURCE:SEARCHENGINEWATCH.COM9DifficultiesforInternetInformationRetrieval•DiversifiedUsers(puternerds).–Canwedevelopanevolvingsystemthatadaptstouser?•Ambiguityoflanguageexpression–ThisisanimportantissueduetovarietiesofdataontheInternet–Hfilingtechniquestoresolveit?•FalseInformation–Phising,Spam,MisleadingAdvertisement10SpiderArchitectureSharedURLpoolAddanewURLHttpRequesturl_spiderurl_spiderurl_spiderurl_spiderWebSpaceurl_spiderspidersGetanHttpResponseURLDatabaseInterfaceDatabase11SpiderProgramming:startwithHTTP…•SpidersuseHTTPprotocoltoretrievedata…publicclassHttpClientGet{publicstaticvoidmain(String[]args)throwsException{StringserverUrl=".hk";Sockets=newSocket(serverUrl,80);BufferedReaderin=newBufferedReader(newInputStreamReader(s.getInputStream()));PrintStreamout=newPrintStream(s.getOutputStream());out.println("GET/~jia/index.htmlHTTP/1.0");out.println();//“GET”mustbefollowedbyablankline.Stringline;while((line=in.readLine())!=null){System.out.println(">"+line);}s.close();}}12ASimpleHTTPServerpublicclassHttpServer{publicstaticvoidmain(Stringargv[])throwsException{ServerSocketserverSock=newServerSocket(8632);//openserversocketatportwhile(true){Socketnew_s=serverSock.accept();serveRequest(new_s);client.close();}}publicstaticvoidserveRequest(Sockets)throwsException{PrintStreamout=newPrintStream(s.getOutputStream());BufferedReaderin=newBufferedReader(newInputStreamReader(s.getInputStream()));StringhttpCmd=in.readLine();//TheHTTPRequestishttpCmd;String[]httpArgs=httpCmd.split("");if(httpArgs.length<2||!httpArgs[0].equalsIgnoreCase("GET")){out.println("400BadRequest.");return;}StringfContent=readFileContent(httpArgs[1]);if(fContent==null)out.println("404FileNotFound");elseout.println(fContent);}13SpiderinAction!••InitializethequeuewithURLsofknownpagesRepeatdoing:a)b)TakeanURLfromqueueFetchthewebpageandstore/rmationinthepageExtractURLsfromthepageandaddthemtothequeuec)•Assumption:Thewebiswelllinked.14ASimpleSpiderpublicclassSimpleSpider{privateQueuelinkQueue=newLinkedList();privateLinkExtractorextractor=newLinkExtractor();protectedbooleanprocessLink(Stringlink)throwsIOException{System.out.println(link);extractor.parse((newURL(link)).openStream());//parsethepagecontent…..Iteratorit=extractor.getExtLinkIterator();//extractallURLlinksinthispagewhile(it.hasNext())linkQueue.add(it.next());//addnextlinktothequeue}publicvoidwork(StringiLink){linkQueue.add(iLink);//addthislinktothequeuefor(inti=0;i<20;++i){//limitmax#ofwebpagestovisitStringlink=(String)linkQueue.poll();//getalinkfromthequeueif(link==null)break;//nomorelinksprocessLink(link);}}publicstaticvoidmain(String[]args){SimpleSpiderspider=newSimpleSpider();spider.work(".hk");//startfromthislink}15ASimpleSpider(cont’d)publicclassLinkExtractor{privateHtmlHrefParserrefParser=newHtmlHrefParser();//HtmlHrefParserissystemdefinedpublicvoidparse(InputStreamstream)throwsIOException{if(stream==null)thrownewIllegalArgumentException("IllegalArgument");refParser.reset();ParserDelegatorpd=newParserDelegator();pd.parse(newInputStreamReader(stream),refParser,true);}publicIteratorgetExtLinkIterator(){returnrefParser.extLinks.iterator();//returnlistofextURLlinks}publicIteratorgetLocalLinkIterator(){returnrefParser.localLinks.iterator();}}16Cautionsaboutusingspiders••••ItmayaddunexpectedamountoftrafficifpoorlydesignedBeresponsibleforyouractionsTestitlocallybeforerunningitovertheInternetFollowthestandardguidelines–/wc/guidelines.html17WebDataMining:Digraph••••Nodes:webpages(itsaddressisURL)DirectedEdges:hyperlinksfromonewebpagetoanotherContentofanode:thecontentofthecorrespondingwebpageDynamicnatureofthedigraph:–Forsomenodes,thereareoutgoingedgeswedon’tknowyet.••Ncessed(don’tknowitscontent)Newedges(hyperlinks)mayhaveaddedtosomenodes–Forallthenodes,therearesomeincomingedgeswedon’tyetknow.18ConstructWebDigraph•Toconstructthewebdigraph,oneneeds–aspidertoautomaticallycollectURLs–rmationfornodes(URLs)andedges(hyperlinks)•Thewholedigraph(URLs,HyperLinks)ishuge:–162,128,493hosts(2002Juldata)–1,173,109,925users–/stats.htm–Onemayneedgraphalgorithmswithsecondarymemories–Googleusesthousandsofworkstations.19AnExampleDigraphV0V1V2V3V4V5V6AnordinarydigraphHwith7verticesand12edges20PartialMapofWebDigraph•Partialmapmaybesufficientforsomepurposes–e.g.,erestedinasmallportionofthewholeInternet•ApartialmapmaybeconstructedwithinthememoryspaceforanordinaryPC,whichallowsfastperformance.Withpartialmap,wemaynotbeabletohaveallnecessaryinformationforourpurpose•–e.g.,backlinkstoaURL21AnExampleofaPartialDigraphV0V124110V2V3322V458461V5V6ApartialdigraphH:nodev5isnotyetexplored.Wedon’tknowthatithasoutgoingedgesfromv5thoughweknowitsexistence(byitsURL).22UnknownandDynamicFactorsofWebStructure•ThereisnocentralcontrolofthehyperlinksandeachsearchenginecanonlymapafractionofthewholewebspaceHyperlinksaredynamicallyaddedanddeletedbyindividualwebpageauthorsNowebpageknowsitsincominghyperlinksSomewebpagesarenotdocumentedbyanysearchengine•••23SomeUsefulFunctionsonDigraph•Back_Link(the_url):–findoutalltheurlsthatpointtothe_url•Shortest_Path(url1,url2):–returntheshortestpathfromurl1tourl2•Maximal_Clique(url):–returnamaximalcliquethatcontainsurl•In-Degree(url)––returnthenumberoflinksthatpointtotheurl.represents,tosomeextent,itspopularity.Themoreawebpageispointedtobywebpages,erestedin•Relateddatastructures,algorithmsandwebsites––––/javadocs/pt/tumba/links/WebGraph.html/introcs/45graph/Digraph.java.html/products/qed/docs/source/_di_graph_8java-source.html/~kris/Research/agl/doc/agl2/Digraph.html24BackLinksofDigraph•Hyperlinksonthewebareforward-pointing.Webpagesdonotknowthehyperlinkspointingbacktothem–authorsofwebpagescanfreelylinktootherdocumentsinthecyberspacewithoutconsentfromtheirauthors•Brmationisimportant–inscientificliterature,SCI(ScientificCitationIndex)isanimportantindexforjudgmentofacademicvalueofoneacademicarticle•Itisnoteasytofindallthebacklinks25CollectBackLinkInformationViaHTTPSection10.HeaderfielddefinitionofHttp1.0subsection10.13Referer:–Refererfield(inrequest-header)allowstheclient(browser)tospecifythesourceaddress(URI)fromwhichtheRequest-URIwasobtained.–Thisallowsaservertogeneratelistsofback-linkstoresourcesforinterest,logging,optimizedcaching,etc.–TheRefererfieldisemptyiftherequestisNOTfromawebpage,e.g.,fromtheURIfieldinbrowser(i.e.,thesourcedoesnothaveanURI).–Fordetails,see•/rfc/rfc1945.txt26AnApplicationofBackLink:FAN••Fansofawebpagehasalinkpointingtothewebpage.Auserwouldaddalinktoawebpageafterheaccessedandviewedthecontentofthepage.fansFansofawebpage27FAN:AnIndicatorofPopularity••Themorefansawebpagehas,themorepopularitis.SCI(ScientificCitationIndex),forexample,isawellknownmethodtoratetheimportanceofaresearchpaper.However,someverypopularwebpagesaresowellknownthatpeopledon’tneedtoputthemintheirwebpages,such,,etc.Anothercontroversialargumentaboutbacklinkpopularity:••–apagepointedbysomeimportantwebpages,comparedwithanotherpointedbymanyun-importantpages?28WebPageRanking•Twofactorsforrankingawebpage:–Therankofwebpagespointingtoit•Thehighthebetter–Thenumberofoutgoinglinksinthewebpagespointingtoit•Thelessthebetter•PageRankofpageA,PR(A),iscalculatedasfollows:–SupposepageAhaspagesT1...Tnthatpointtoit(i.e.,backlinks).–disafactorbetween0and1(usuallysetto0.85).–C(T)isthenumberofoutgoinglinksofpageT.29PageRankCalculation•ThedefinitionofPR(A)iscyclic,i.e.,therankofapagedependsontheranksofotherpages.However,pageranksputedbyasimpleiterativealgorithm.Pagerankscanbeefficientlycalculatedbyusingwebdigraph.Pputedinafewhoursonamediumsizeworkstation.Pagerankshelpsearchenginetorankthesearchresultsaccordingtotheirpopularityorimportance(noconsiderationofrelevanceofsearchresultshere).••30InvertedFile:indexingforsearchWordExtractionWordIDsOriginalDocumentsW1:d1,d2,d3W2:d2,d4,d7,d9DocumentIDsWn:di,…dnInvertedFiles31Term-Documentindexing1.Ms(documents)tofileIDsConsiderthefollowingOriginalDocumentsd1TheDepartmentofComputerSciencewasestablishedin1984.d2TheDepartmentlauncheditsfirstBSc(Hons)inComputerStudiesin1987.followedbytheMScinComputerSciencewhichwasstartedin1991.TheDduceditsfirstPhDgraduatein1994.d3d4d5Ofessionallytotheadvancementsinthesefields.32RemoveStopWords2.Removestopwords(“in”,“the”,“in”,….)thatarenotmeaningfulforsearchd1TheDepartmentofComputerSciencewasestablishedin1984.d2TheD

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论