สถาปัตยกรรมบริการแบบแยกส่วนเพื่อจัดทำดัชนีและค้นหา URL โดยเนื้อหาโดยใช้ CouchDB+Lucene เป็นเครื่องมือค้นหา
หมายเหตุ: โครงการนี้ยังอยู่ระหว่างการพัฒนาอย่างหนักโปรดคาดหวังว่าจะมี WIP!
หมายเหตุ: (ต้องใช้นักเทียบท่าและนักเทียบท่า)
// 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
หมายเหตุ: (ต้องใช้นักเทียบท่าและนักเทียบท่า)
// 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 Initializer
สำหรับการทดสอบบริการอย่างรวดเร็วเรียกใช้คำสั่งนี้:
cd DatabaseInit
./docker_build.sh
./docker_run.sh
ตอบสนอง WebApp UI
สำหรับการทดสอบบริการอย่างรวดเร็วเรียกใช้คำสั่งนี้:
cd UI
./docker_build.sh
./docker_run.sh
open http://localhost:8080
บริการเว็บสกรีนช็อตง่าย ๆ ที่ขับเคลื่อนโดย Express และ Phantomjs แยกจากสกรีนช็อต-แอป
เอกสารต้นฉบับมีความน่าเชื่อถือที่นี่
สำหรับการทดสอบบริการอย่างรวดเร็วเรียกใช้คำสั่งนี้:
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 และ Cheerio.js
สำหรับการทดสอบบริการอย่างรวดเร็วเรียกใช้คำสั่งนี้:
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 ส่งออกไฟล์ 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
UI ทดลองใช้ Vue.js, เซิร์ฟเวอร์ HTTP WebPack-Dev-Server พื้นฐาน, ยังไม่มีแบ็กเอนด์ที่ยังไม่ได้ใช้งาน
สำหรับการทดสอบบริการอย่างรวดเร็วเรียกใช้คำสั่งนี้:
cd UI
npm install
npm start
open http://localhost:8080
บริการ URL-to-Index ที่เรียบง่าย ส่งเนื้อสัตว์รับ sauge
สิ่งนี้ต้องใช้ URL ที่กำหนดผ่าน GetContentFromurl จากนั้นผลักมันเข้าไปในฐานข้อมูล searchengine CouchDB ที่ CouchDB-Lucene กำลังจัดทำดัชนีเอกสาร
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 .