描述:新加坡NTU的CI6226信息檢索和分析分配。
小組:14
成員:Ke Xiangyu,Li Jinjin,Li Xihan,Zhou Shengsheng
項目主頁:https://github.com/zhoushengsheng/ci6226-ira-g14
信息檢索在我們的日常生活中起著巨大的作用。我們始終想搜索我們關心或想使用Google,Baidu,Bing等搜索引擎的信息。我們使用的應用程序,例如Twitter,YouTube或eBay向我們推薦,總會有新的朋友,電影或產品。這些服務都是基於信息檢索的。在某個時候,在信息時代,人類很難在沒有信息檢索的情況下生活。 Stack Overflow是一個問答網站,它允許程序員搜索,詢問,回答並就問題發表評論。我們的項目旨在提供搜索引擎系統,以使用戶根據堆棧溢出數據的一部分快速搜索他們的問題。我們還構建了另外兩個應用程序來分析數據。一種應用程序是檢索2008年至2016年每種編程語言的受歡迎程度。另一個應用程序是根據其答案計數對用戶進行排名。






該項目是基於堆棧溢出帖子數據構建的。您可以在https://archive.org/download/stackexchange/stackoverflow.com-posts.7z上下載數據文件。它很大,大約10 GB。下載數據文件後,請取消壓縮以獲取posts.xml文件。該項目的應用程序在帖子之上構建其索引和文檔。xml數據文件。
打開日食,選擇[導入 - > Maven->現有的Maven項目] 。選擇根目錄作為CI6226-IRA-G14,然後在窗口中選擇所有項目。單擊完成以完成導入。
您可以在src/main/resources/application.yml文件中更改應用程序配置。例如,您可以更改端口,posts.xml路徑和索引路徑。有關配置參數的更多詳細信息,請參閱特定的.yml文件。
每個項目都有相同的運行方式。讓我們以搜索引擎為例:右鍵單擊ci6226.ira.g14.search.engine的main.java,然後選擇[運行為 - > spring boot應用程序] 。然後,搜索引擎將在9001端口上運行並收聽。以下列表列出了所有主要類別,默認偵聽項目的端口:
| 應用 | main.java軟件包 | 港口 |
|---|---|---|
| 搜尋引擎 | ci6226.ira.g14.search.engine.main.java | 9001 |
| 語言趨勢 | ci6226.ira.g14.app.language.trend.main.java | 9002 |
| 回答用戶排名 | ci6226.ira.g14.app.answering.user.ranking.main.java | 9003 |
| 前端 | ci6226.ira.g14.fe.main.java | 8000 |
打開Intellij,在“歡迎”頁面中,選擇[創建項目 - >空項目 - > NEXT->導航位置到CI6226 -IRA -G14->完成] 。
然後,在項目結構窗口中,將所有項目添加為模塊,通過選擇['+'符號 - >導入模塊 - >選擇G14 -Search -engine(或其他) - > open-> open-> open-> open->從外部模塊 - > maven-> maven-> next ... - > binitive Import模塊] 。
與第2.1節(2)節中所述相同。
右鍵單擊main.java,然後選擇“ main”運行。有關詳細的main.java軟件包和端口,請參閱第2.1節。(3)。
如果您的系統中沒有安裝Maven,請參閱MAVEN安裝指南以安裝Maven。安裝指南在https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html上。
與第2.1節(2)節中所述相同。
以搜索引擎為例:
輸入搜索引擎項目的根目錄:
$ cd /path/to/g14-search-engine
運行應用程序:
$ mvn spring-boot:run
搜索引擎應用程序將在9001端口上運行和收聽。其他應用程序共享相同的程序以在終端運行。
您可以使用Web瀏覽器訪問http:// localhost:8000來訪問前端的主要網頁。搜索輸入框位於網頁的中心。您可以輸入搜索關鍵字,然後選擇要搜索的字段。然後單擊搜索按鈕,搜索結果將被渲染。如果您想進行另一個搜索,則可以簡單地在左上角輸入框中輸入關鍵字,而回到主頁。
URL是http:// localhost:8000/語言。選擇年結束的開始,然後單擊搜索按鈕。語言趨勢結果將在圖中呈現。
URL是http:// localhost:8000/用戶。在左上方的框中輸入最高數字用戶,然後單擊搜索按鈕。結果將在下面的列表中渲染。
如果您想與沒有網頁的搜索引擎進行交互,則可以。搜索引擎公開了網頁實際獲取數據的API。
GET http://localhost:9000/api/search?field=all&keywords=python+convert+string+to+int&count=2
field: title, body or all
keywords: query keywords (url encoded)
count: top N results
[
{
"title" : " converting string to int python " ,
"body" : " <p>how can I convert a string to an int in python n say I have this array</p> nn <pre><code>['(111,11,12)','(12,34,56)'] to [(111,11,12),(12,34,56)] n </code></pre> nn <p>Any help will be appreciated thanks</p> n " ,
"docId" : 582335 ,
"score" : 30.801956
},
{
"title" : " Python: Recursively convert int to binary string " ,
"body" : " <p>I am trying to recursively convert int to binary string but I don't really understand how the whole positive int to binary string conversion works.</p> nn <p>Also found out that apparently each position is like a representation of the power of 2.</p> nn <p>Any explanation as to how to convert a positive int to a string representation as shown in the Googled example above is extremely helpful.</p> n " ,
"docId" : 608825 ,
"score" : 28.072052
}
] GET http://localhost:9001/api/language_trend?rankLanguages=java%2Cc%2Cpython%2Cphp&startYear=2015&endYear=2016
rankLanguages: programming languages that you want to get trend (url encoded)
startYear: star year
endYear: end year
{
"2015" : [
{
"name" : " java " ,
"popularity" : 50467
},
{
"name" : " c " ,
"popularity" : 35010
},
{
"name" : " python " ,
"popularity" : 59565
},
{
"name" : " php " ,
"popularity" : 58975
}
],
"2016" : [
{
"name" : " java " ,
"popularity" : 49137
},
{
"name" : " c " ,
"popularity" : 34022
},
{
"name" : " python " ,
"popularity" : 70951
},
{
"name" : " php " ,
"popularity" : 59549
}
]
} GET http://localhost:9002/api/user_ranking?userCount=3
userCount: top N users
[
{
"userID" : " 22656 " ,
"username" : " Jon Skeet " ,
"anwseredCount" : 33477
},
{
"userID" : " 1144035 " ,
"username" : null ,
"anwseredCount" : 31656
},
{
"userID" : " 29407 " ,
"username" : " Darin " ,
"anwseredCount" : 21217
}
]我們提供了Shell腳本,以輕鬆將應用程序部署到遠程服務器。請注意,這些腳本只能在Unix,Linux,Mac OS等類似Unix的系統中使用。它們不能用於Windows。
為了使用腳本進行部署,您需要配置遠程服務器以通過SSH鍵登錄。如果您的服務器沒有以這種方式配置,請參閱本教程,以獲取有關如何配置的指南:https://www.digitalocean.com/community/tutorials/how-to-conto-configure-shefure-ssh-key-sh--------------------------------------------------------------------------------------------------------
而且,您還需要配置防火牆以允許應用程序中使用的TCP端口。
腳本在每個項目的根目錄中。例如,在搜索引擎項目中,腳本為:
下一步是修改deploy.sh以將用戶和服務器設置為您的:
REMOTE_SERVER=your_server_address
REMOTE_USER=your_server_user並修改server.sh以配置Java環境:
export JAVA_HOME=/path/to/jdk最後,您可以運行deploy.sh以自動構建和部署項目到遠程服務器:
$ ./deploy.sh