ElasticSearch學習筆記(九)Java AP實現搜尋,排序,高亮,分頁
雖然上一篇中的對索引的搜尋可以在一定程度上獲取索引的資訊,但是畢竟功能是有限的,本篇主要是對elasticsearch使用javaAPI實現搜尋功能的筆記。
一、搜尋
package test;
import static org.elasticsearch.index.query.QueryBuilders.termQuery;
import java.net.InetAddress;
import java.util.HashMap;
import java.util.Map;
import org.apache.lucene.index.Terms;
import org.elasticsearch.action.search.MultiSearchResponse;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.script.ScriptType;
import org.elasticsearch.script.mustache.SearchTemplateRequestBuilder;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.aggregations.AggregationBuilders;
import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval;
import org.elasticsearch.search.sort.FieldSortBuilder;
import org.elasticsearch.search.sort.SortOrder;
import org.elasticsearch.transport.client.PreBuiltTransportClient;
@SuppressWarnings({ "resource","deprecation" })
public class testSearch {
public static void main(String[] args) throws Exception{
searchmethod6();
}
/**
* 方法一
* @throws Exception
*/
public static void searchmethod1() throws Exception{
TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("106.14.112.215"), 9300));
SearchResponse response = client.prepareSearch("movies").setTypes("movie").get();
println(response);
for (SearchHit searchHit: response.getHits()) {
println(searchHit);
}
}
/**
* 方法二
* @throws Exception
*/
public static void searchmethod2() throws Exception{
TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("106.14.112.215"), 9300));
QueryBuilder qb1 = termQuery("user","10");
// QueryBuilder qb2 = QueryBuilders.multiMatchQuery("git", "title", "content");
SearchResponse response = client.prepareSearch("movies").setQuery(qb1).get();
for (SearchHit searchHit: response.getHits()) {
println(searchHit);
}
}
/**
* 方法三
* @throws Exception
* 這個相當於之前的分頁,使用的是Scroll方法
*/
public static void searchmethod3() throws Exception{
TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("106.14.112.215"), 9300));
QueryBuilder qb = termQuery("user", "kimchy");
SearchResponse scrollResp = client.prepareSearch("movies")
.addSort(FieldSortBuilder.DOC_FIELD_NAME, SortOrder.ASC)
.setScroll(new TimeValue(60000))
.setQuery(qb)
.setSize(1).get();
do {
for (SearchHit hit : scrollResp.getHits().getHits()) {
println(hit);
}
scrollResp = client.prepareSearchScroll(scrollResp.getScrollId()).setScroll(new TimeValue(60000)).execute().actionGet();
} while(scrollResp.getHits().getHits().length != 0);
}
/**
* 方法四
* @throws Exception
*/
public static void searchmethod4() throws Exception{
TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("106.14.112.215"), 9300));
SearchRequestBuilder srb1 = client.prepareSearch().setQuery(QueryBuilders.queryStringQuery("kimchy"));
SearchRequestBuilder srb2 = client.prepareSearch().setQuery(QueryBuilders.matchQuery("user", "kimchy"));
MultiSearchResponse sr = client.prepareMultiSearch().add(srb1).add(srb2).get();
for (MultiSearchResponse.Item item : sr.getResponses()) {
SearchResponse response = item.getResponse();
for (SearchHit searchHit : response.getHits()) {
println(searchHit);
}
}
}
/**
* 方法五
* 這個方法先欠著,不是很懂
* @throws Exception
*/
public static void searchmethod5() throws Exception{
TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("106.14.112.215"), 9300));
SearchResponse sr = client.prepareSearch()
.setQuery(QueryBuilders.matchAllQuery())
.addAggregation(
AggregationBuilders.terms("agg1").field("field")
)
.addAggregation(
AggregationBuilders.dateHistogram("agg2")
.field("birth")
.dateHistogramInterval(DateHistogramInterval.YEAR)
)
.get();
// Get your facet results
Terms agg1 = sr.getAggregations().get("agg1");
// DateHistogram agg2 = sr.getAggregations().get("agg2");
}
/**
* 方法六
* 能執行,但是就是不知道為什麼查詢不到結果,同時感覺這種方法很雞肋,感覺寫起來很麻煩,順便說一下這個東西好像也可以在script下配置,我測試失敗,但是感覺沒什麼用,就不深究了。
* https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-search-template.html
* @throws Exception
*/
public static void searchmethod6() throws Exception{
TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("106.14.112.215"), 9300));
Map<String, Object> json = new HashMap<>();
json.put("param_gender", "1962");
SearchResponse response = new SearchTemplateRequestBuilder(client)
.setScript("{\n" +
" \"query\" : {\n" +
" \"match\" : {\n" +
" \"year\" : \"{{param_gender}}\"\n" +
" }\n" +
" }\n" +
"}")
.setScriptType(ScriptType.INLINE)
.setScriptParams(json)
.setRequest(new SearchRequest())
.get()
.getResponse();
println(response);
System.out.println(response.getHits().getTotalHits());
for (SearchHit searchHit : response.getHits()) {
println(searchHit);
}
}
/**
* 輸出結果SearchResponse
* @param response
*/
public static void println(SearchResponse response){
System.err.println("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-");
System.err.println(
"getFailedShards : " + response.getFailedShards() + "\n" +
"getNumReducePhases : " + response.getNumReducePhases() + "\n" +
"getScrollId : " + response.getScrollId() + "\n" +
"getTookInMillis : " + response.getTookInMillis() + "\n" +
"getTotalShards : " + response.getTotalShards() + "\n" +
"getAggregations : " + response.getAggregations() + "\n" +
"getProfileResults : " + response.getProfileResults() + "\n" +
"getShardFailures : " + response.getShardFailures() + "\n" +
"getSuggest : " + response.getSuggest() + "\n" +
"getTook : " + response.getTook() + "\n" +
"isTerminatedEarly : " + response.isTerminatedEarly() + "\n" +
"isTimedOut : " + response.isTimedOut() + "\n" +
"remoteAddress : " + response.remoteAddress() + "\n" +
"status : " + response.status() + "\n" +
"getHits : " + response.getHits()
);
}
/**
* 輸出結果SearchResponse
* @param response
*/
public static void println(SearchHit searchHit){
System.err.println("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-");
System.err.println(
"docId : " + searchHit.docId() + "\n" +
"getId : " + searchHit.getId() + "\n" +
"getIndex : " + searchHit.getIndex()+ "\n" +
"getScore : " + searchHit.getScore() + "\n" +
"getSourceAsString : " + searchHit.getSourceAsString() + "\n" +
"getType : " + searchHit.getType() + "\n" +
"getVersion : " + searchHit.getVersion() + "\n" +
"fieldsOrNull : " + searchHit.fieldsOrNull() + "\n" +
"getExplanation : " + searchHit.getExplanation() + "\n" +
"getFields : " + searchHit.getFields() + "\n" +
"highlightFields : " + searchHit.highlightFields() + "\n" +
"hasSource : " + searchHit.hasSource()
);
}
}
二、DSL搜尋
package test;
import static org.elasticsearch.index.query.QueryBuilders.*;
import java.net.InetAddress;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.transport.client.PreBuiltTransportClient;
@SuppressWarnings({"resource","deprecation"})
public class testDSL {
static TransportClient client;
//https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-query-dsl.html
public static void main(String[] args) throws Exception {
client = new PreBuiltTransportClient(Settings.EMPTY)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("106.14.112.215"), 9300));
// _matchAllQuery();
/**
* 從這往下是全文檢索的
*/
// _matchQuery();
// _multiMatchQuery();
// _commonTermsQuery();
// _queryStringQuery();
// _simpleQueryStringQuery();
/**
* 從這往下主要運營與數字、日期、列舉等型別的檢索
*/
// _termQuery();
// _termsQuery();
// _rangeQuery();
// _existsQuery();
// _prefixQuery();
// _wildcardQuery();
// _fuzzyQuery();
// _typeQuery();
_idsQuery();
}
/**
* 方法一:獲取所有
* @throws Exception
*/
public static void _matchAllQuery() throws Exception{
QueryBuilder qb = matchAllQuery();
dealQueryBuilder(qb);
}
/**
* 方法二:指定單查詢條件
* @throws Exception
*/
public static void _matchQuery() throws Exception{
QueryBuilder qb = matchQuery(
"user" ,
"kimchy"
);
dealQueryBuilder(qb);
}
/**
* 方法三:指定多查詢條件
* @throws Exception
*/
public static void _multiMatchQuery() throws Exception{
QueryBuilder qb = multiMatchQuery(
"kimchy elasticsearch",
"user", "message"
);
dealQueryBuilder(qb);
}
/**
* 方法四:感覺和方法二_matchQuery一樣,不知道差別
* @throws Exception
*/
public static void _commonTermsQuery() throws Exception{
QueryBuilder qb = commonTermsQuery("user",
"kimchy");
dealQueryBuilder(qb);
}
/**
* 方法五:+包含 -除外,但是這個查詢沒有結果,很奇怪
* @throws Exception
*/
public static void _queryStringQuery() throws Exception{
QueryBuilder qb = queryStringQuery("+kimchy -elasticsearch");
dealQueryBuilder(qb);
}
/**
* 方法六:+包含 -除外
* @throws Exception
*/
public static void _simpleQueryStringQuery() throws Exception{
QueryBuilder qb = simpleQueryStringQuery("+kimchy -elasticsearch");
dealQueryBuilder(qb);
}
//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
/**
* 方法七_:termQuery
* @throws Exception
*/
public static void _termQuery() throws Exception{
QueryBuilder qb = termQuery(
"user",
"kimchy"
);
dealQueryBuilder(qb);
}
/**
* 方法八:_termsQuery
* @throws Exception
*/
public static void _termsQuery() throws Exception{
QueryBuilder qb = termsQuery("tags",
"blue", "pill");
dealQueryBuilder(qb);
}
/**
* 方法九:_rangeQuery
* @throws Exception
*/
public static void _rangeQuery() throws Exception{
QueryBuilder qb = rangeQuery("price")
.from(5)
.to(10)
.includeLower(true)
.includeUpper(false);
// A simplified form using gte, gt, lt or lte
QueryBuilder _qb = rangeQuery("age")
.gte("10")
.lt("20");
dealQueryBuilder(qb);
}
/**
* 方法十:_existsQuery
* 匹配含有user欄位的記錄
* @throws Exception
*/
public static void _existsQuery() throws Exception{
QueryBuilder qb = existsQuery("user");
dealQueryBuilder(qb);
}
/**
* 方法十一:_prefixQuery
* 匹配user中字首為fds的記錄
* @throws Exception
*/
public static void _prefixQuery() throws Exception{
QueryBuilder qb = prefixQuery(
"user",
"fds"
);
dealQueryBuilder(qb);
}
/**
* 方法十二:_wildcardQuery
* 萬用字元
* @throws Exception
*/
public static void _wildcardQuery() throws Exception{
QueryBuilder qb = wildcardQuery("user", "k?mc*");
dealQueryBuilder(qb);
}
/**
* 方法十三:_fuzzyQuery
* @throws Exception
*/
public static void _fuzzyQuery() throws Exception{
QueryBuilder qb = fuzzyQuery(
"user",
"kimzhy"
);
dealQueryBuilder(qb);
}
/**
* 方法十四:_typeQuery
* @throws Exception
*/
public static void _typeQuery() throws Exception{
QueryBuilder qb = typeQuery("movie");
dealQueryBuilder(qb);
}
/**
* 方法十五:_idsQuery
* 型別是可選的
* @throws Exception
*/
public static void _idsQuery() throws Exception{
QueryBuilder qb = idsQuery("movie")
.addIds("1", "4", "100");
dealQueryBuilder(qb);
}
/**
* 這部分程式碼的複用性太高了,抽離出來。
* @param qb
*/
public static void dealQueryBuilder(QueryBuilder qb){
SearchResponse response = client.prepareSearch("movies").setQuery(qb).get();
for (SearchHit searchHit : response.getHits()) {
println(searchHit);
}
}
/**
* 輸出結果SearchResponse
* @param response
*/
public static void println(SearchHit searchHit){
System.err.println("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-");
System.err.println(
"docId : " + searchHit.docId() + "\n" +
"getId : " + searchHit.getId() + "\n" +
"getIndex : " + searchHit.getIndex()+ "\n" +
"getScore : " + searchHit.getScore() + "\n" +
"getSourceAsString : " + searchHit.getSourceAsString() + "\n" +
"getType : " + searchHit.getType() + "\n" +
"getVersion : " + searchHit.getVersion() + "\n" +
"fieldsOrNull : " + searchHit.fieldsOrNull() + "\n" +
"getExplanation : " + searchHit.getExplanation() + "\n" +
"getFields : " + searchHit.getFields() + "\n" +
"highlightFields : " + searchHit.highlightFields() + "\n" +
"hasSource : " + searchHit.hasSource()
);
}
}
三、分詞、排序、高亮
package test;
import java.net.InetAddress;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;
import org.elasticsearch.search.sort.FieldSortBuilder;
import org.elasticsearch.search.sort.SortBuilder;
import org.elasticsearch.search.sort.SortBuilders;
import org.elasticsearch.search.sort.SortOrder;
import org.elasticsearch.transport.client.PreBuiltTransportClient;
@SuppressWarnings({ "resource", "deprecation" })
public class testUtil {
public static void main(String[] args) throws Exception {
// fenye();
sort();
// highlighter();
}
/**
* 分頁
* @throws Exception
*/
public static void fenye() throws Exception {
TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("106.14.112.215"), 9300));
SearchResponse response = client.prepareSearch("movies")
.setQuery(QueryBuilders.matchAllQuery())
.setFrom(10)
.setSize(20)
.execute().actionGet();
for (SearchHit searchHit : response.getHits()) {
println(searchHit);
}
}
/**
* 排序
* @throws Exception
*/
public static void sort() throws Exception {
TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("106.14.112.215"), 9300));
SearchResponse response = client.prepareSearch("movies")
.setQuery(QueryBuilders.matchAllQuery())
.addSort("postDate", SortOrder.ASC)
.execute().actionGet();
for (SearchHit searchHit : response.getHits()) {
println(searchHit);
}
}
/**
* 高亮
* @throws Exception
*/
public static void highlighter() throws Exception{
TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("106.14.112.215"), 9300));
QueryBuilder matchQuery = QueryBuilders.matchQuery("user", "kimchy");
HighlightBuilder hiBuilder=new HighlightBuilder();
hiBuilder.preTags("<h2>");
hiBuilder.postTags("</h2>");
hiBuilder.field("user");
// 搜尋資料
SearchResponse response = client.prepareSearch("movies")
.setQuery(matchQuery)
.highlighter(hiBuilder)
.execute().actionGet();
for (SearchHit searchHit : response.getHits()) {
println(searchHit);
}
}
/**
* 輸出結果SearchResponse
* @param response
*/
public static void println(SearchHit searchHit){
System.err.println("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-");
System.err.println(
"docId : " + searchHit.docId() + "\n" +
"getId : " + searchHit.getId() + "\n" +
"getIndex : " + searchHit.getIndex()+ "\n" +
"getScore : " + searchHit.getScore() + "\n" +
"getSourceAsString : " + searchHit.getSourceAsString() + "\n" +
"getType : " + searchHit.getType() + "\n" +
"getVersion : " + searchHit.getVersion() + "\n" +
"fieldsOrNull : " + searchHit.fieldsOrNull() + "\n" +
"getExplanation : " + searchHit.getExplanation() + "\n" +
"getFields : " + searchHit.getFields() + "\n" +
"highlightFields : " + searchHit.highlightFields() + "\n" +
"hasSource : " + searchHit.hasSource()
);
}
}
相關推薦
ElasticSearch學習筆記(九)Java AP實現搜尋,排序,高亮,分頁
雖然上一篇中的對索引的搜尋可以在一定程度上獲取索引的資訊,但是畢竟功能是有限的,本篇主要是對elasticsearch使用javaAPI實現搜尋功能的筆記。 一、搜尋 package test; import static org.elastics
Elasticsearch學習筆記(九)partial update
cse adding 操作 nbsp 進行 樂觀 gin clas 比較 一、什麽是partial update? PUT /index/type/id,創建文檔&替換文檔,就是一樣的語法 一般對應到應用程序中,每次的執行流程基本是這樣的: (1)應
java學習筆記(九)-- java新特性 ( 可變引數 & 泛型 & 靜態匯入 & 型別擦除 )
JDK1.5新特性 方法的可變引數 設計一個方法,可以接收任意個數的整數,並返回他們的相加結果
JAVA SE學習筆記(九)Java集合
1 Java集合框架 1.1 概述 Java提供集合類的目的是——為了儲存數量不確定的資料,以及儲存具有對映關係的資料,集合類也被稱為是容器類,處於java.util包下。集合類和陣列的區別:陣列元素可以是基本型別的值,也可以是物件,而集合
java學習筆記(九):Java 流(Stream)、文件(File)和IO
用戶輸入 public 文件內容 輸出流 out 單個 java 我們 ready Java 的控制臺輸入由 System.in 完成。 為了獲得一個綁定到控制臺的字符流,你可以把 System.in 包裝在一個 BufferedReader 對象中來創建一個字符流。需要i
《瘋狂Java講義》學習筆記(九)異常處理
1、異常概述 異常機制已經成為判斷一門程式語言是否成熟的標準,目前主流的程式語言都提供了成熟的異常機制,增加了異常處理機制後的程式有更好的容錯性,更加健壯 Java的異常機制主要依賴於:try、catch、finally、throws和throw Java7
Java for Web學習筆記(九):Servlet(7)上傳檔案
上傳檔案 Servlet的引數設定 採用annotation方式如下: @WebServlet( name = "TicketServlet", urlPatterns = {"/tickets"}, loadOnStartup = 1 ) /* MultipartConfig配置了本Servlet
TypeScript學習筆記(九):裝飾器(Decorators)
標註 時裝 als cal () 操作 enume 筆記 文檔 裝飾器簡介 裝飾器(Decorators)為我們在類的聲明及成員上通過元編程語法添加標註提供了一種方式。 需要註意的是:裝飾器是一項實驗性特性,在未來的版本中可能會發生改變。 若要啟用實驗性的裝飾器特性
如鵬網學習筆記(九)JavaScript
計算機編程 lean 有效 拼接字符串 {} efault 含義 函數重載 cas JavaScript筆記 一、JavaScript簡介 1,JavaScript是一種計算機編程語言,可以像等其他編程語言那樣定義變量,執行循環等。 2,JavaScript代碼主
Python學習筆記(九)
port 驗證方式 模塊 install name 第三方模塊 rom pip private 一、Python模塊的引入 import sys #可以通過模塊名以及import關鍵字導入模塊 二、if __name__ == "__main__" 當Python在
深度學習筆記(九)感受野計算
lds 時有 輸入 計算 ret name %d have imsi 1 感受野的概念 在卷積神經網絡中,感受野的定義是 卷積神經網絡每一層輸出的特征圖(feature map)上的像素點在原始圖像上映射的區域大小。一般感受野大小是目標大小的兩倍左右最合適!
學習筆記(九)——數據庫存儲結構:頁、聚集索引、非聚集索引
分享 style end 宋體 blog lec storage rop cas 1、頁 SQL Server用8KB 的頁來存儲數據,並且在SQL Server裏磁盤 I/O 操作在頁級執行。也就是說,SQL Server 讀取或寫入所有數據頁。頁有不同的類型,像
Java學習筆記(二)---java 修飾符
技術 外部類 blog 訪問權限 定義 log 發生 繼承 指向 一、java 修飾符 Java語言提供了很多修飾符,主要分為以下兩類: 訪問修飾符 非訪問修飾符 1、訪問控制修飾符 Java中,可以使用訪問控制符來保護對類、變量、方法和構造方法的訪問。Javav支持
Elasticsearch學習筆記(四)ElasticSearch分布式機制
clas cse 負載均衡 丟失 數據 不可 分布式 復雜 發生 一、Elasticsearch對復雜分布式機制透明的隱藏特性 1、分片機制: (1)index包含多個shard,每個shard都是一個最小工作單元,承載部分數據,lucen
Elasticsearch學習筆記(六)核心概念和分片shard機制
服務器 存儲 play wid 讀寫 number 容錯 組成 操作 一、核心概念 1、近實時(Near Realtime NRT) (1)從寫入數據到數據可以被搜索到有一個小延遲(大概1秒); (2)基於es執行搜索和分析可以達到秒級
Elasticsearch學習筆記(十)批量查詢mget、批量增刪改bulk
出錯 color body 換行 nor test 增刪 doc document 一、批量查詢 mget GET /_mget { "docs":[ { "_index":"ecommerce
python學習筆記(九)之語句1
如果 red 開始 就是 整除 for 循環 個數 hello 基本 python學習筆記(九)之語句1printpython2中,print是一個語句,python3中它是一個函數。實例1: >> print "hello,world!"
day5-Python學習筆記(九)json數據類型
class json mps pen log imp color python 文件 import json#json串就是字符串。d = { ‘car‘:{‘color‘:‘red‘,‘price‘:100,‘count‘:50}, ‘挨糞叉‘:{‘color‘:
《Qt5 開發與實例(第三版)》學習筆記(九)
nal inf lin exc ken right item vbo ott 1 // 3.4 基本布局(QLayout) 2 //dialog.h 3 #ifndef DIALOG_H 4 #define DIALOG_H 5 6 #incl