当前位置: 首页 > wzjs >正文

网站的手机版m站怎么做18款禁用网站app直播

网站的手机版m站怎么做,18款禁用网站app直播,html5简单网页大作业,帮助做ppt的网站#测试拼音分词 POST /_analyze { "text":"如家酒店真不错", "analyzer": "pinyin" } #这里把拼音的首字母放到这里,也说明了这句话没有被分词,而是作为一个整体出现的 #还把每一个字都形成了一个拼音&#…

#测试拼音分词
POST /_analyze
{
  "text":"如家酒店真不错",
  "analyzer": "pinyin"
}
#这里把拼音的首字母放到这里,也说明了这句话没有被分词,而是作为一个整体出现的
#还把每一个字都形成了一个拼音,这也没什么用 大多数情况下我们想用中文搜索

#自定义分词器  创建test索引库的时候指定字段使用自定义的分词
PUT /test
{
  "settings": {
    "analysis": {
      "analyzer": {
          "my_analyzer":{
          "tokenizer":"ik_max_word",
          "filter":"py"
        } 
      },
      "filter":{
        "py":{
          "type":"pinyin",
          "keep_full_pinyin":false,
          "keep_joined_full_pinyin":true,
          "keep_original":true,
          "limit_first_letter_length":16,
          "remove_duplicated_term":true,
          "none_chinese_pinyin_tokenize":false
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "name":{
        "type": "text",
        "analyzer": "my_analyzer"
      }
    }
  }
}

#删除索引库
DELETE /test

#查询索引库
GET /test


#在分词分词的汉字拼音都有,而且还有分词的首字母拼音
POST /test/_analyze
{
  "text":["如家酒店真不错"],
  "analyzer": "my_analyzer"
}

#在索引库test中插入一些文档
POST /test/_doc/1
{
  "id":1,
  "name":"狮子"
}

POST /test/_doc/2
{
  "id":2,
  "name":"虱子"
}

#搜索:有点问题搜索拼音,把同音字也搜到了
GET /test/_search
{
  "query": {
    "match": {
      "name": "shizi"
    }
  }
}

#在创建的时候可以用拼音选择器,在搜索的时候不应该用拼音选择器,搜索用search_analyzer,在搜索是用户输入的是中文,用户用中文去搜,输入的是拼音,才拿拼音去搜

#自定义分词器  创建test索引库的时候指定字段使用自定义的分词
PUT /test
{
  "settings": {
    "analysis": {
      "analyzer": {
          "my_analyzer":{
          "tokenizer":"ik_max_word",
          "filter":"py"
        } 
      },
      "filter":{
        "py":{
          "type":"pinyin",
          "keep_full_pinyin":false,
          "keep_joined_full_pinyin":true,
          "keep_original":true,
          "limit_first_letter_length":16,
          "remove_duplicated_term":true,
          "none_chinese_pinyin_tokenize":false
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "name":{
        "type": "text",
        "analyzer": "my_analyzer",
        "search_analyzer": "ik_smart"
      }
    }
  }
}
#现在搜索是用户输入的是中文,用户用中文去搜,输入的是拼音,才拿拼音去搜
GET /test/_search
{
  "query": {
    "match": {
      "name": "虱子"
    }
  }
}


#自动补全  参与自动补全的的字段必须是completion类型,字段的内容一般是用来补全的多个词条形成的数组
#创建索引库
PUT /test2
{
  "mappings": {
    "properties": {
      "title":{
        "type": "completion"
      }
    }
  }
}

#查询索引库
GET /test2

#删除索引库
DELETE /test2

#插入数据
POST test2/_doc
{
  "title":["Sorry","WH-1000XM3"]
}

POST test2/_doc
{
  "title":["SK-IT","PITERA"]
}

POST test2/_doc
{
  "title":["Nintendo","switch"]
}

#自动补全查询
GET /test2/_search
{
  "suggest":{
    "titleSuggest":{
      "text":"s",
      "completion":{
        "field":"title",
        "skip_duplicates":true,
        "size":10
      }
    }
  }
}

GET /test2/_search
{
  "suggest":{
    "titleSuggest":{
      "text":"so",
      "completion":{
        "field":"title",
        "skip_duplicates":true,
        "size":10
      }
    }
  }
}

#查看索引库的结构
GET /hotel/_mapping

#删除索引库
DELETE /hotel

#酒店数据索引库
#定义了两个分词器,全文检索用text_anlyzer,自动补全用completion_analyzer
PUT /hotel
{
  "settings": {
    "analysis": {
      "analyzer": {
        "text_anlyzer": {
          "tokenizer": "ik_max_word",
          "filter": "py"
        },
        "completion_analyzer": {
          "tokenizer": "keyword",
          "filter": "py"
        }
      },
      "filter": {
        "py": {
          "type": "pinyin",
          "keep_full_pinyin": false,
          "keep_joined_full_pinyin": true,
          "keep_original": true,
          "limit_first_letter_length": 16,
          "remove_duplicated_term": true,
          "none_chinese_pinyin_tokenize": false
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "id":{
        "type": "keyword"
      },
      "name":{
        "type": "text",
        "analyzer": "text_anlyzer",
        "search_analyzer": "ik_smart",
        "copy_to": "all"
      },
      "address":{
        "type": "keyword",
        "index": false
      },
      "price":{
        "type": "integer"
      },
      "score":{
        "type": "integer"
      },
      "brand":{
        "type": "keyword",
        "copy_to": "all"
      },
      "city":{
        "type": "keyword"
      },
      "starName":{
        "type": "keyword"
      },
      "business":{
        "type": "keyword",
        "copy_to": "all"
      },
      "location":{
        "type": "geo_point"
      },
      "pic":{
        "type": "keyword",
        "index": false
      },
      "all":{
        "type": "text",
        "analyzer": "text_anlyzer",
        "search_analyzer": "ik_smart"
      },
      "suggestion":{
          "type": "completion",
          "analyzer": "completion_analyzer"
      }
    }
  }
}

#查询所有
GET /hotel/_search
{
  "query":{
    "match_all": {}
  }
}

#自动补全查询
GET /hotel/_search
{
  "suggest":{
    "suggestions":{
      "text":"h",
      "completion":{
        "field":"suggestion",
        "skip_duplicates":true,
        "size":10
      }
    }
  }
}

 //自动补全查询:@Testvoid testSuggest() throws IOException {//准备requuestSearchRequest request=new SearchRequest("hotel");//准备DSLrequest.source().suggest(new SuggestBuilder().addSuggestion("suggestions",SuggestBuilders.completionSuggestion("suggestion").prefix("hz").skipDuplicates(true).size(10)));//发起请求SearchResponse response = client.search(request, RequestOptions.DEFAULT);//解析结果System.out.println(response);Suggest suggest = response.getSuggest();//根据补全查询名称,获取补全结果CompletionSuggestion suggestions= suggest.getSuggestion("suggestions");//获取optionsList<CompletionSuggestion.Entry.Option> options = suggestions.getOptions();//遍历for (CompletionSuggestion.Entry.Option option:options){String text = option.getText().toString();System.out.println(text);}}

@Overridepublic List<String> getSuggestions(String prefix) {//准备requuestSearchRequest request=new SearchRequest("hotel");//准备DSLrequest.source().suggest(new SuggestBuilder().addSuggestion("suggestions",SuggestBuilders.completionSuggestion("suggestion").prefix(prefix).skipDuplicates(true).size(10)));try {//发起请求SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);//解析结果System.out.println(response);Suggest suggest = response.getSuggest();//根据补全查询名称,获取补全结果CompletionSuggestion suggestions= suggest.getSuggestion("suggestions");//获取optionsList<CompletionSuggestion.Entry.Option> options = suggestions.getOptions();//遍历List<String> list=new ArrayList<>(options.size());for (CompletionSuggestion.Entry.Option option:options){String text = option.getText().toString();System.out.println(text);list.add(text);}return list;} catch (IOException e) {throw new RuntimeException(e);}}

http://www.dtcms.com/wzjs/464995.html

相关文章:

  • 创业做网站 优帮云seo外包服务方案
  • 免费html网站模板下载站长统计是什么意思
  • 做教育app的网站有哪些手机优化管家
  • 示范建设验收网站seo门户
  • wordpress关闭日志长沙seo优化推广公司
  • 外国人做的汉子网站营销型网站建设需要多少钱
  • 保护环境网站模板seo 首页
  • 德清网站设计电商运营的基本流程
  • 住房和城建设网站怎么在广告联盟接广告
  • 广州冼村是什么梗sem优化
  • dedecms两网站共享用户名网络营销的常用方法有哪些
  • 网站内容页面怎么做的软文写作模板
  • 酒店网站建设流程google官网登录
  • 做网站的怎么挣钱网络推广站
  • 阿里巴巴怎么做企业网站深圳seo优化排名优化
  • 梅州免费建站找哪家厦门seo小谢
  • 用360打开自己做的网站有广告seo优化技术培训中心
  • 福建省建设继续教育网站近期国际热点大事件
  • 彩票网站怎么做的什么软件可以推广自己的产品
  • 韶关网站建设墨子南京网站制作设计
  • 最专业企业营销型网站建设2024新闻热点事件
  • 购物网站制作实例宁波网站推广找哪家公司
  • 廊坊网站建设哪家权威seo优化的优点
  • 淄博优化网站排名升华网络推广软件
  • 可以做外链的网站有哪些代运营哪家比较可靠
  • 网站编程 mysql求好用的seo软件
  • htmlsubmit回调网站建设discuz论坛seo设置
  • 网站服务器维护工具android优化大师
  • 快速建站用什么深圳网站开发
  • 做哪些网站比较赚钱自己怎么做网站网页