模塊化服務體系結構以使用CouchDB+Lucene作為搜索ENGENE的內容索引和搜索URL。
注意:這個項目仍在重大開發中,請期待一些WIP!
注意:(需要Docker和Docker-Compose)
// Build docker containers (1st time)
docker-compose build
// Launch all required services
# [PRODUCTION]
docker-compose up
# [DEVELOPMENT]
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up
// Open UI
open http://localhost:8080
注意:對於完整的couchdb數據重置運行(警告,所有數據將被刪除):
docker-compose rm && rm DatabaseInit/dbinitstatus/.dbinitdone
注意:(需要Docker和Docker-Compose)
// Test GetImageFromURL
open http://localhost:3000/?url=www.botdream.com&width=1024&height=900
// Test GetContentFromURL
curl http://localhost:6000/?url=www.botdream.com
// Open CouchDB UI
open http://localhost:5984/_utils/database.html?searchengine/_all_docs
// Test CouchDB+Lucene search
curl -X GET --silent http://localhost:5984/_fti/local/searchengine/_design/search/by_content?q=brilliant&include_docs=true | jq .
//DBProxy service
[POST] curl -d 'url=http://www.botdream.com' http://localhost:8000/url
[DELETE] curl -X DELETE http://localhost:8000/remove/http-botdream-com-botdream-com-botdream-com%2F2017-04-21T23%3A11%3A04.910Z | jq .
[GET] curl http://localhost:8000/search/botdream | jq .
// shutdown services
docker-compose stop
OR
CTRL+C in the original terminal
// clean services data (reset containers)
docker-compose rm
// when changing source code you should rebuild docker images, use this generic command to build all and ignore cache (will take some time, forces to rebuild all images from scratch)
docker-compose build --no-cache
托多:
CouchDB數據庫初始化器。
對於快速服務測試,運行此命令:
cd DatabaseInit
./docker_build.sh
./docker_run.sh
React WebApp UI。
對於快速服務測試,運行此命令:
cd UI
./docker_build.sh
./docker_run.sh
open http://localhost:8080
由Express和Phantomjs提供支持的簡單屏幕截圖Web服務。從屏幕截圖分配。
原始文檔可在此處避免
對於快速服務測試,運行此命令:
cd GetImageFromURL
./docker_build.sh
./docker_run.sh
open http://localhost:3000/?url=www.botdream.com&width=1024&height=900
// or with clipping params
open http://localhost:3000/?url=www.botdream.com&width=1024&height=900&clipRect=%7B%22top%22%3A0%2C%22left%22%3A0%2C%22width%22%3A1024%2C%22height%22%3A800%7D
curl http://localhost:3000/?url=www.botdream.com&width=1024&height=900 > botdream.png
curl --silent http://localhost:3000/?url=www.botdream.com&width=1024&height=900 | imgcat
由Express and Cheerio.js提供動力的簡單內容刮擦Web服務
對於快速服務測試,運行此命令:
cd GetContentFromURL
./docker_build.sh
./docker_run.sh
curl http://localhost:6000/?url=www.botdream.com
創建一個數據庫和一些文檔,然後您可以開始設置和查詢索引,如Couchdb-Lucene Readme中所述。
對於快速服務測試,運行此命令:
cd CouchDBLucene
docker-compose up
./database_init.sh
open http://localhost:5984/_utils/
curl -X GET --silent http://localhost:5984/_fti/local/searchengine/_design/search/by_content?q=nirvana&include_docs=true | jq .
curl -X GET --silent http://localhost:5984/_fti/local/searchengine/_design/search/by_content?q=einstein&include_docs=true | jq .
curl -X GET --silent http://localhost:5984/_fti/local/searchengine/_design/search/by_content?q=brilliant&include_docs=true | jq .
// Clear CouchDB data
docker-compose rm
有關Couchdb-Lucene FullText的更多信息,這裡:Couchdblucene-Fulltext-Search
一個簡單的工具,可以在解析Google Chrome Book Markit將HTML文件出口到CouchDB-Lucene中。
對於快速服務測試,運行此命令:
cd SendFavoritesToCouchDB
# export Chrome Bookmark file to ./bookmarks_sample.html
# ./build.sh # in case you need to change the sourcecode and compile the tool
# Launch CouchDB-Lucene service and initialize database
# Launch GetContentFromURL service
./SendFavoritesToCouchDB ./bookmarks_sample.html
使用vue.js,基本的WebPack-Dev-server HTTP服務器的實驗UI,尚未實現後端,都無法使用Docker容器!
對於快速服務測試,運行此命令:
cd UI
npm install
npm start
open http://localhost:8080
簡單的URL到索引服務。發送肉,獲得帆。
這將採用給定的URL,將其通過GetContentFromurl,然後將其推入CouchDB-Lucene索引文檔的searchengine Couchdb數據庫中。
curl -d'url = http://www.botdream.com'http:// localhost:8000/url
然後完成後:
curl -X GET --silent http://localhost:5984/_fti/local/searchengine/_design/search/by_content?q=botdream&include_docs=true | jq .
注意:服務引擎現在按標題索引:
curl -X GET --silent http://localhost:5984/_fti/local/searchengine/_design/search/by_title?q=botdream&include_docs=true | jq .
另外:DBProxy現在正在實現搜索端點(這避免了UI直接需要數據到CouchDB,也將來也可以使用其他DB引擎並使用此服務=>查看Elasticsearch)
curl -X GET --silent http://localhost:8000/search/botdream | jq .