Elasticsearch for Java趟坑记录
MQTT + NodeJS + Weixin Small-Program
OnlineChat – Egg+Webpack+Socket.IO
Class4 Website
Plugin Plants.VS.Zombies
Game 2048
Game Tetris
Game Snake
项目地址 安装 elasticsearch 我安装的是6.2.2版本,刚入坑不太敢用新版本的,怕找资料麻烦,这也直接影响后续安装的插件得是6.2.2同是6.x版本的都不行 kibana 6.2.2 方便管理elasticsearch的工具,启动后访问localhost:5601可以直接在控制台进行测试 # 查看健康状态,Green为正常 GET /_cat/health?v GET /_cat/indices?v GET /_cluster/health?pretty=true # 如果状态是Yellow,可以进行以下设置 PUT /_settings { "index" : { "number_of_replicas" : 0 } } elasticsearch-analysis-ik 中文分词插件 版本要和elasticsearch一致,即6.2.2 在elasticsearch安装目录plguins下新建ik文件夹,解压elasticsearch-analysis-ik到ik文件夹 自定义词库 我是用清华开放词库的开放词库,选择需要的词典拼在一起,做成userdict.txt 进入config目录,将自定义词典放在该目录下 修改IKAnalyzer.cfg.xml自定义词典的路径 $xslt <entry key="ext_dict">userdict.txt</entry> 重启elasticsearch 记录 以下Ocr和TextResult为自定义的类 lombok使用 Lombok简介 Jest索引操作 | ik中文分词设置 注意ik_smart和ik_max_words区别 elasticsearch节点基本的设置已经废弃,手动设置索引级别如下 PUT ocr { "settings": { "index": { "number_of_shards": 1, "number_of_replicas": 1 }, "analysis": { "analyzer": { "ik": { "tokenizer": "ik_smart" } } } }, "mappings": { "doc": { "dynamic": true, "properties": { "textResult":{ "type": "nested", "properties": { "text":{ "type": "text", "analyzer": "ik_smart", "search_analyzer": "ik_smart" } } }, "ocrText": { "type": "text", "analyzer": "ik_smart", "search_analyzer": "ik_smart" } } } } } 创建索引 Jest java创建索引的操作方法如下: public JestResult createIndexMapping(String index, String settinsJson, String mappingsJson) { JestResult jestResult = null; try { CreateIndex createIndex = new CreateIndex.Builder(index) .settings(settinsJson) .mappings(mappingsJson) .build(); jestResult = jestClient.execute(createIndex); log.info("createIndexMapping result:{}" + jestResult.isSucceeded()); if (!jestResult.isSucceeded()) { log.error("settingIndexMapping error:{}" + jestResult.getErrorMessage()); } } catch (IOException e) { e.printStackTrace(); } return jestResult; } settingsJson和mappingsJson都是以上拼接好的字符串,主要分布要取"settings":{}和"mappings":{}内的部分 判断索引是否存在 判断索引是否存在,判断result.isSucceeded() public JestResult indicesExists(String index) { IndicesExists indicesExists = new IndicesExists.Builder(index).build(); JestResult result…
使用NodeJS、mosca模块搭建本地HTTPS和MQTT服务器,并在微信小程序中测试连接服务器。Demo完整代码见Github ...
See project PorYoung/allChat, an online chat web application based on egg.js and sockt.io. Egg + Webpack + Socket.io Notes Directory Structure - app - controller - extend - middleware - model - service - public - dist /* webpack output directory */ - io /* socket.io */ - controller - middleware - view - router.js - config - config.default.js - plugin.js - build /* webpack */ - src - webpack.config.js - ... Egg Quick Usage npm i egg-init -g egg-init egg-example --type=simple cd egg-example npm i npm run dev The server listens on 7001. See egg for more detail. Config config/config.default.js default content 'use strict'; const path = require('path'); module.exports = appInfo => { const config = exports = {}; // use for cookie sign key, should change to your own and keep security config.keys = appInfo.name + 'your_keys'; // add your config here return config; } middleware // add your middleware config.middleware = ['permission','middleware2']; // your middleware config, which will be the param 'options' you can access later config.permission = { excludeUrl: { 'ALL':…
click to visit website website constructure -index.php -announce.php -favicon.ico -api ---download.php ---handle.php ---sendMessage.php -admin ---adminLogin.php ---adminLogin_handle.php ---adminSystem.php ---announceAdd.php ---annouceManager.php ---annouceModify.php ---annouceModifyHandle.php ---destroyLogin.php ---downFile.php ---fileManage.php ---handle_function.php ---loginCheck.php ---messageManage.php ---signUp.php ---signUp_handle.php ---userManage.php ---config.php ---connect.php -css -js -img -music -fla -database_back -version connect with mysql database /** * config.php * define mysql connect infomation */ define('HOST','localhost'); define('USERNAME','root'); define('PASSWORD','123456'); /** * connect.php * connect to mysql database */ //require config file require_once('config.php'); //connect with daatabase if(!$conn = mysqli_connect(HOST,USERNAME,PASSWORD)){ echo mysqli_error($conn); } //select databse if(!mysqli_select_db($conn,'database name')){ echo mysqli_error($conn); } //set character sets if(!mysqli_query($conn,'SET NAMES UTF8')){ echo mysqli_error($conn); } file handle //define function readDirectory(path) function readDirectory($path){ //open dir and save as variable $handle $handle = opendir($path); $arr = null; while(($item = readdir($handle)) !== false){ //read successful and exclude the condition, dot and double dots(. & ..) if ($item!="."&&$item!="..") { //test if is file if (is_file($path."/".$item)) { $arr['file'][] = $item; } if (is_dir($path."/".$item)) { $arr['dir'][] = $item; } } } closedir($handle); return $arr; } //get file size : filesize($path) //get extension name : explode('.',$filename) //delete file : unlink($path) //define function uploadFile($file) function…
No abstract.
No abstract.
No abstract.
No abstract.