<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>OpenSearch アーカイブ - Sheltie Garage Tech</title>
	<atom:link href="https://sheltie-garage.xyz/tech/category/opensearch/feed/" rel="self" type="application/rss+xml" />
	<link>https://sheltie-garage.xyz/tech/category/opensearch/</link>
	<description>テクノロジー関連の話題をまとめたブログです</description>
	<lastBuildDate>Sun, 07 Jul 2024 13:08:16 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>一言メモ：OpenSearchServiceで処理反映まで待つ方法</title>
		<link>https://sheltie-garage.xyz/tech/2024/07/%e4%b8%80%e8%a8%80%e3%83%a1%e3%83%a2%ef%bc%9aopensearchservice%e3%81%a7%e5%87%a6%e7%90%86%e5%8f%8d%e6%98%a0%e3%81%be%e3%81%a7%e5%be%85%e3%81%a4%e6%96%b9%e6%b3%95/</link>
					<comments>https://sheltie-garage.xyz/tech/2024/07/%e4%b8%80%e8%a8%80%e3%83%a1%e3%83%a2%ef%bc%9aopensearchservice%e3%81%a7%e5%87%a6%e7%90%86%e5%8f%8d%e6%98%a0%e3%81%be%e3%81%a7%e5%be%85%e3%81%a4%e6%96%b9%e6%b3%95/#respond</comments>
		
		<dc:creator><![CDATA[monodon]]></dc:creator>
		<pubDate>Sun, 07 Jul 2024 13:08:15 +0000</pubDate>
				<category><![CDATA[Go]]></category>
		<category><![CDATA[OpenSearch]]></category>
		<guid isPermaLink="false">https://sheltie-garage.xyz/tech/?p=1084</guid>

					<description><![CDATA[<p>現象 個人的に作成しているアプリで、OpenSearchに更新を実施後、すぐに検索を行うと削除したはずの記事が検索結果に含まれてしまうOpenSeearchへのアクセスにはgo-clientを使用している 対応方法 De [&#8230;]</p>
<p>投稿 <a href="https://sheltie-garage.xyz/tech/2024/07/%e4%b8%80%e8%a8%80%e3%83%a1%e3%83%a2%ef%bc%9aopensearchservice%e3%81%a7%e5%87%a6%e7%90%86%e5%8f%8d%e6%98%a0%e3%81%be%e3%81%a7%e5%be%85%e3%81%a4%e6%96%b9%e6%b3%95/">一言メモ：OpenSearchServiceで処理反映まで待つ方法</a> は <a href="https://sheltie-garage.xyz/tech">Sheltie Garage Tech</a> に最初に表示されました。</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">現象</h2>



<p>個人的に作成しているアプリで、OpenSearchに更新を実施後、すぐに検索を行うと削除したはずの記事が検索結果に含まれてしまう<br>OpenSeearchへのアクセスにはgo-clientを使用している</p>



<h2 class="wp-block-heading">対応方法</h2>



<p>Deleteリクエストを送信する際のパラメータを、以下のように設定する</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-plain"><code>	deleteReq := opensearchapi.DocumentDeleteReq{
		Index:      &quot;index&quot;,
		DocumentID: 1,
		Params: opensearchapi.DocumentDeleteParams{
			Refresh: &quot;wait_for&quot;,
		},
	}</code></pre></div>



<p>Refresh: &#8220;wait_for&#8221;を指定することで、削除が反映されるまでリクエストが待機されます(デフォルトはfalse)</p>



<h2 class="wp-block-heading">参考</h2>



<p><a href="https://zenn.dev/kyo18/articles/b8409bff18d277">elasticsearchのrefreshに関して</a></p>



<p><a href="https://opensearch.org/docs/latest/api-reference/document-apis/delete-by-query/">Delete by query</a></p>



<h2 class="wp-block-heading">宣伝</h2>


<div id="rinkerid1021" class="yyi-rinker-contents  yyi-rinker-postid-1021 yyi-rinker-img-m yyi-rinker-catid-16 yyi-rinker-catid-18 ">
	<div class="yyi-rinker-box">
		<div class="yyi-rinker-image">
							<a href="https://af.moshimo.com/af/c/click?a_id=3394378&#038;p_id=54&#038;pc_id=54&#038;pl_id=616&#038;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2F%25E5%2588%259D%25E3%2582%2581%25E3%2581%25A6%25E3%2581%25AEGo%25E8%25A8%2580%25E8%25AA%259E%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow"><img decoding="async" src="https://thumbnail.image.rakuten.co.jp/@0_mall/booxstore/cabinet/01139/bk4814400047.jpg?_ex=128x128" width="128" height="128" class="yyi-rinker-main-img" style="border: none;"></a><img decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</div>
		<div class="yyi-rinker-info">
			<div class="yyi-rinker-title">
									<a href="https://af.moshimo.com/af/c/click?a_id=3394378&#038;p_id=54&#038;pc_id=54&#038;pl_id=616&#038;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2F%25E5%2588%259D%25E3%2582%2581%25E3%2581%25A6%25E3%2581%25AEGo%25E8%25A8%2580%25E8%25AA%259E%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow">初めてのGo言語 他言語プログラマーのためのイディオマティックGo実践ガイド／JonBodner／武舎広幸【3000円以上送料無料】</a><img decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">							</div>
			<div class="yyi-rinker-detail">
							<div class="credit-box">created by&nbsp;<a href="https://oyakosodate.com/rinker/" rel="nofollow noopener" target="_blank" >Rinker</a></div>
										<div class="price-box">
							<span title="" class="price">¥3,960</span>
															<span class="price_at">(2026/04/05 22:26:24時点&nbsp;楽天市場調べ-</span><span title="このサイトで掲載されている情報は当サイトの作成者により運営されています。価格、販売可能情報は、変更される場合があります。購入時に楽天市場店舗（www.rakuten.co.jp）に表示されている価格がその商品の販売に適用されます。">詳細)</span>
																	</div>
						</div>
						<ul class="yyi-rinker-links">
																                    <li class="amazonlink">
						<a href="https://www.amazon.co.jp/gp/search?ie=UTF8&amp;keywords=%E5%88%9D%E3%82%81%E3%81%A6%E3%81%AEGo%E8%A8%80%E8%AA%9E&amp;tag=monodon-22&amp;index=blended&amp;linkCode=ure&amp;creative=6339" rel="nofollow" class="yyi-rinker-link">Amazon</a>					</li>
													<li class="rakutenlink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616&amp;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2F%25E5%2588%259D%25E3%2582%2581%25E3%2581%25A6%25E3%2581%25AEGo%25E8%25A8%2580%25E8%25AA%259E%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow" class="yyi-rinker-link">楽天市場</a><img decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</li>
													<li class="yahoolink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502&amp;url=https%3A%2F%2Fshopping.yahoo.co.jp%2Fsearch%3Fp%3D%25E5%2588%259D%25E3%2582%2581%25E3%2581%25A6%25E3%2581%25AEGo%25E8%25A8%2580%25E8%25AA%259E" rel="nofollow" class="yyi-rinker-link">Yahooショッピング</a><img decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502" width="1" height="1" style="border:none;">					</li>
				                											</ul>
					</div>
	</div>
</div>
<p>投稿 <a href="https://sheltie-garage.xyz/tech/2024/07/%e4%b8%80%e8%a8%80%e3%83%a1%e3%83%a2%ef%bc%9aopensearchservice%e3%81%a7%e5%87%a6%e7%90%86%e5%8f%8d%e6%98%a0%e3%81%be%e3%81%a7%e5%be%85%e3%81%a4%e6%96%b9%e6%b3%95/">一言メモ：OpenSearchServiceで処理反映まで待つ方法</a> は <a href="https://sheltie-garage.xyz/tech">Sheltie Garage Tech</a> に最初に表示されました。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sheltie-garage.xyz/tech/2024/07/%e4%b8%80%e8%a8%80%e3%83%a1%e3%83%a2%ef%bc%9aopensearchservice%e3%81%a7%e5%87%a6%e7%90%86%e5%8f%8d%e6%98%a0%e3%81%be%e3%81%a7%e5%be%85%e3%81%a4%e6%96%b9%e6%b3%95/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>OpenSearchでなにか作るぞ!(その8 フロントサイドを引き続きつくる）</title>
		<link>https://sheltie-garage.xyz/tech/2023/10/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9e%e3%81%9d%e3%81%ae8-%e3%83%95%e3%83%ad%e3%83%b3%e3%83%88%e3%82%b5%e3%82%a4%e3%83%89%e3%82%92%e5%bc%95%e3%81%8d%e7%b6%9a/</link>
					<comments>https://sheltie-garage.xyz/tech/2023/10/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9e%e3%81%9d%e3%81%ae8-%e3%83%95%e3%83%ad%e3%83%b3%e3%83%88%e3%82%b5%e3%82%a4%e3%83%89%e3%82%92%e5%bc%95%e3%81%8d%e7%b6%9a/#respond</comments>
		
		<dc:creator><![CDATA[monodon]]></dc:creator>
		<pubDate>Tue, 10 Oct 2023 08:44:30 +0000</pubDate>
				<category><![CDATA[OpenSearch]]></category>
		<category><![CDATA[React]]></category>
		<guid isPermaLink="false">https://sheltie-garage.xyz/tech/?p=897</guid>

					<description><![CDATA[<p>最近あまり作業できていなかったdAnimeSearchプロジェクト。今回はフロントを引き続き作っていきます。 イベントハンドラとダミーデータでモックを作成する 前回まででざっくりとフォルダ構成やコンポーネントの構成を決め [&#8230;]</p>
<p>投稿 <a href="https://sheltie-garage.xyz/tech/2023/10/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9e%e3%81%9d%e3%81%ae8-%e3%83%95%e3%83%ad%e3%83%b3%e3%83%88%e3%82%b5%e3%82%a4%e3%83%89%e3%82%92%e5%bc%95%e3%81%8d%e7%b6%9a/">OpenSearchでなにか作るぞ!(その8 フロントサイドを引き続きつくる）</a> は <a href="https://sheltie-garage.xyz/tech">Sheltie Garage Tech</a> に最初に表示されました。</p>
]]></description>
										<content:encoded><![CDATA[
<p>最近あまり作業できていなかったdAnimeSearchプロジェクト。<br>今回はフロントを引き続き作っていきます。</p>



<h2 class="wp-block-heading">イベントハンドラとダミーデータでモックを作成する</h2>



<p>前回まででざっくりとフォルダ構成やコンポーネントの構成を決めました。<br>今回はひとまずイベントハンドラとダミーデータを作成して、大まかに動くようにしたいと思います。</p>



<p>前回のおさらいです</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="587" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/10/20231010_001-1024x587.png" alt="" class="wp-image-898" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/10/20231010_001-1024x587.png 1024w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/10/20231010_001-300x172.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/10/20231010_001-768x440.png 768w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/10/20231010_001.png 1242w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>・components &#8211; template : 検索条件と検索結果をそれぞれ表示するテンプレート<br>・components &#8211; ui-elements:ボタンやテキストボックスなどの最小単位のコンポーネント<br>・pages:親コンポーネントに位置するコンポーネント。この中でテンプレートを読み込む</p>



<h3 class="wp-block-heading">SearchConditionTemplate.tsxの中身</h3>



<div class="hcb_wrap"><pre class="prism line-numbers lang-ts" data-lang="TypeScript"><code>import SearchButton from &quot;../ui-elements/SearchButton&quot;;
import SearchTextBox from &quot;../ui-elements/SearchTextBox&quot;;

const SearchConditionTemplate = (props : any) =&gt; {
    return(
        &lt;div&gt;
            &lt;SearchTextBox onChange={props.handleKeywordChange} /&gt;&lt;SearchButton onClick={props.onClick}/&gt;
        &lt;/div&gt;
    );
}

export default SearchConditionTemplate;</code></pre></div>



<p>こんな感じで、テキストボックスと検索用ボタンのみとなります。<br>各イベントハンドラは親コンポーネントからプロパティ経由で取得します。</p>



<h3 class="wp-block-heading">SearchResultTemplate.tsxの中身</h3>



<div class="hcb_wrap"><pre class="prism line-numbers lang-ts" data-lang="TypeScript"><code>import SearchResultCard from &quot;../ui-elements/SearchResultCard&quot;;

const SearchResultTemplate = (searchResultProps: any) =&gt; {

    let list = [];

    if(searchResultProps == null){
        return ;
    }

    for(const [i, result] of searchResultProps.results.entries()){
        list.push(&lt;SearchResultCard result/&gt;);
    }

    return(
        &lt;div&gt;
            {list}
        &lt;/div&gt;
    );
}

export default SearchResultTemplate;</code></pre></div>



<p>検索結果を表示するだけのページになります。プロパティ経由で検索結果を受け取り、画面に表示します。</p>



<h3 class="wp-block-heading">search.tsxの中身</h3>



<div class="hcb_wrap"><pre class="prism line-numbers lang-plain"><code>import { SetStateAction, useState } from &quot;react&quot;;
import SearchConditionTemplate from &quot;@/components/template/SearchConditionTemplate&quot;;
import SearchResultTemplate from &quot;@/components/template/SearchResultTemplate&quot;;


const Search = () =&gt; {

    // ステートの宣言
    const [keyword, setKeyword] = useState(&#39;&#39;);
    const [searchResults, setSearchResults] = useState&lt;any[]&gt;([]);

    // 入力値変更イベントハンドラ
    const handleKeywordChange = (e : any) =&gt; {
        console.log(&quot;キーワード変更&quot;);
        setKeyword(e.target.value);
      };

    // 検索イベントハンドラ
    const handleSearch = () =&gt; {
        console.log(&quot;検索クリック&quot;);
        // ここで実際の検索処理を実装する
        // 例: ダミーの検索結果を設定
        const dummyResults = [
          { id: 1, title: &#39;検索結果1&#39; },
          { id: 2, title: &#39;検索結果2&#39; },
          { id: 3, title: &#39;検索結果3&#39; },
        ];
        setSearchResults(dummyResults);
      };

    return(
        &lt;div className=&quot;App&quot;&gt;
            &lt;SearchConditionTemplate handleKeywordChange={handleKeywordChange} onClick={handleSearch}/&gt;
            &lt;SearchResultTemplate results={searchResults}/&gt;
        &lt;/div&gt;
    );
}

export default Search</code></pre></div>



<p>親コンポーネントとなるsearchコンポーネントの中身。<br>各テンプレートを読み込んで表示を行うことと、イベントハンドラやステートを宣言し、各コンポーネントへプロパティ経由で受け渡します。</p>



<p>検索結果は今のところダミーデータですが、将来的に検索ボタンをクリックしたときにOpenSearchに検索を行い、結果を受け渡すように変更します。</p>



<h2 class="wp-block-heading">ここまでの動き</h2>



<p>ここまで作成すると、以下のような画面になります。</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="472" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/10/20231010_002-1024x472.png" alt="" class="wp-image-899" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/10/20231010_002-1024x472.png 1024w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/10/20231010_002-300x138.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/10/20231010_002-768x354.png 768w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/10/20231010_002.png 1503w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>見た目がかなりしょぼい上に、実行時エラーも発生してしまっていますが、良いのです。<br>このあたりの不具合はこの後修正します。</p>



<h2 class="wp-block-heading">今回はここまで</h2>



<p>ということで、本日はここまで。<br>進みは遅いですが、趣味で作っているものなのでご勘弁を。<br>毎週少しでも開発を続けていれば、いつかは完成する精神なので長い目でお付き合いいただけたらと思います。</p>


<div id="rinkerid863" class="yyi-rinker-contents  yyi-rinker-postid-863 yyi-rinker-img-m yyi-rinker-catid-18 yyi-rinker-catid-8 ">
	<div class="yyi-rinker-box">
		<div class="yyi-rinker-image">
							<a href="https://af.moshimo.com/af/c/click?a_id=3394378&#038;p_id=54&#038;pc_id=54&#038;pl_id=616&#038;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2Freact%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow"><img decoding="async" src="https://thumbnail.image.rakuten.co.jp/@0_mall/book/cabinet/9163/9784297129163_1_4.jpg?_ex=128x128" width="128" height="128" class="yyi-rinker-main-img" style="border: none;" loading="lazy"></a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</div>
		<div class="yyi-rinker-info">
			<div class="yyi-rinker-title">
									<a href="https://af.moshimo.com/af/c/click?a_id=3394378&#038;p_id=54&#038;pc_id=54&#038;pl_id=616&#038;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2Freact%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow">TypeScriptとReact/Next.jsでつくる実践Webアプリケーション開発 [ 手島 拓也 ]</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">							</div>
			<div class="yyi-rinker-detail">
							<div class="credit-box">created by&nbsp;<a href="https://oyakosodate.com/rinker/" rel="nofollow noopener" target="_blank" >Rinker</a></div>
										<div class="price-box">
							<span title="" class="price">¥3,498</span>
															<span class="price_at">(2026/04/06 10:06:19時点&nbsp;楽天市場調べ-</span><span title="このサイトで掲載されている情報は当サイトの作成者により運営されています。価格、販売可能情報は、変更される場合があります。購入時に楽天市場店舗（www.rakuten.co.jp）に表示されている価格がその商品の販売に適用されます。">詳細)</span>
																	</div>
						</div>
						<ul class="yyi-rinker-links">
																                    <li class="amazonlink">
						<a href="https://www.amazon.co.jp/gp/search?ie=UTF8&amp;keywords=react&amp;tag=monodon-22&amp;index=blended&amp;linkCode=ure&amp;creative=6339" rel="nofollow" class="yyi-rinker-link">Amazon</a>					</li>
													<li class="rakutenlink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616&amp;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2Freact%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow" class="yyi-rinker-link">楽天市場</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</li>
													<li class="yahoolink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502&amp;url=https%3A%2F%2Fshopping.yahoo.co.jp%2Fsearch%3Fp%3Dreact" rel="nofollow" class="yyi-rinker-link">Yahooショッピング</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502" width="1" height="1" style="border:none;">					</li>
				                											</ul>
					</div>
	</div>
</div>


<div id="rinkerid645" class="yyi-rinker-contents  yyi-rinker-postid-645 yyi-rinker-img-m yyi-rinker-catid-18 yyi-rinker-catid-8 ">
	<div class="yyi-rinker-box">
		<div class="yyi-rinker-image">
							<a href="https://af.moshimo.com/af/c/click?a_id=3394378&#038;p_id=54&#038;pc_id=54&#038;pl_id=616&#038;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FGo%25E8%25A8%2580%25E8%25AA%259E%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow"><img decoding="async" src="https://thumbnail.image.rakuten.co.jp/@0_mall/book/cabinet/9694/9784873119694_1_3.jpg?_ex=128x128" width="128" height="128" class="yyi-rinker-main-img" style="border: none;" loading="lazy"></a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</div>
		<div class="yyi-rinker-info">
			<div class="yyi-rinker-title">
									<a href="https://af.moshimo.com/af/c/click?a_id=3394378&#038;p_id=54&#038;pc_id=54&#038;pl_id=616&#038;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FGo%25E8%25A8%2580%25E8%25AA%259E%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow">実用 Go言語 システム開発の現場で知っておきたいアドバイス [ 渋川 よしき ]</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">							</div>
			<div class="yyi-rinker-detail">
							<div class="credit-box">created by&nbsp;<a href="https://oyakosodate.com/rinker/" rel="nofollow noopener" target="_blank" >Rinker</a></div>
										<div class="price-box">
							<span title="" class="price">¥3,960</span>
															<span class="price_at">(2026/04/05 22:52:40時点&nbsp;楽天市場調べ-</span><span title="このサイトで掲載されている情報は当サイトの作成者により運営されています。価格、販売可能情報は、変更される場合があります。購入時に楽天市場店舗（www.rakuten.co.jp）に表示されている価格がその商品の販売に適用されます。">詳細)</span>
																	</div>
						</div>
						<ul class="yyi-rinker-links">
																                    <li class="amazonlink">
						<a href="https://www.amazon.co.jp/gp/search?ie=UTF8&amp;keywords=Go%E8%A8%80%E8%AA%9E&amp;tag=monodon-22&amp;index=blended&amp;linkCode=ure&amp;creative=6339" rel="nofollow" class="yyi-rinker-link">Amazon</a>					</li>
													<li class="rakutenlink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616&amp;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FGo%25E8%25A8%2580%25E8%25AA%259E%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow" class="yyi-rinker-link">楽天市場</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</li>
													<li class="yahoolink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502&amp;url=https%3A%2F%2Fshopping.yahoo.co.jp%2Fsearch%3Fp%3DGo%25E8%25A8%2580%25E8%25AA%259E" rel="nofollow" class="yyi-rinker-link">Yahooショッピング</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502" width="1" height="1" style="border:none;">					</li>
				                											</ul>
					</div>
	</div>
</div>
<p>投稿 <a href="https://sheltie-garage.xyz/tech/2023/10/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9e%e3%81%9d%e3%81%ae8-%e3%83%95%e3%83%ad%e3%83%b3%e3%83%88%e3%82%b5%e3%82%a4%e3%83%89%e3%82%92%e5%bc%95%e3%81%8d%e7%b6%9a/">OpenSearchでなにか作るぞ!(その8 フロントサイドを引き続きつくる）</a> は <a href="https://sheltie-garage.xyz/tech">Sheltie Garage Tech</a> に最初に表示されました。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sheltie-garage.xyz/tech/2023/10/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9e%e3%81%9d%e3%81%ae8-%e3%83%95%e3%83%ad%e3%83%b3%e3%83%88%e3%82%b5%e3%82%a4%e3%83%89%e3%82%92%e5%bc%95%e3%81%8d%e7%b6%9a/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>OpenSearchでなにか作るぞ!(その6 アイコンデータを検索出来るようにサーバーサイドを修正する）</title>
		<link>https://sheltie-garage.xyz/tech/2023/08/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9e%e3%81%9d%e3%81%ae6-%e3%82%a2%e3%82%a4%e3%82%b3%e3%83%b3%e3%83%87%e3%83%bc%e3%82%bf%e3%82%92%e6%a4%9c%e7%b4%a2%e5%87%ba/</link>
					<comments>https://sheltie-garage.xyz/tech/2023/08/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9e%e3%81%9d%e3%81%ae6-%e3%82%a2%e3%82%a4%e3%82%b3%e3%83%b3%e3%83%87%e3%83%bc%e3%82%bf%e3%82%92%e6%a4%9c%e7%b4%a2%e5%87%ba/#respond</comments>
		
		<dc:creator><![CDATA[monodon]]></dc:creator>
		<pubDate>Sat, 19 Aug 2023 11:20:36 +0000</pubDate>
				<category><![CDATA[Go]]></category>
		<category><![CDATA[OpenSearch]]></category>
		<guid isPermaLink="false">https://sheltie-garage.xyz/tech/?p=848</guid>

					<description><![CDATA[<p>前回まででOpenSearchのインデックスにアイコンデータを組み込むところまで作成しました。今回は追加したアイコンデータを検索できるように、Goで作成しているサーバーサイドの更新を行います。 クエリの形式を変更する 今 [&#8230;]</p>
<p>投稿 <a href="https://sheltie-garage.xyz/tech/2023/08/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9e%e3%81%9d%e3%81%ae6-%e3%82%a2%e3%82%a4%e3%82%b3%e3%83%b3%e3%83%87%e3%83%bc%e3%82%bf%e3%82%92%e6%a4%9c%e7%b4%a2%e5%87%ba/">OpenSearchでなにか作るぞ!(その6 アイコンデータを検索出来るようにサーバーサイドを修正する）</a> は <a href="https://sheltie-garage.xyz/tech">Sheltie Garage Tech</a> に最初に表示されました。</p>
]]></description>
										<content:encoded><![CDATA[
<p>前回まででOpenSearchのインデックスにアイコンデータを組み込むところまで作成しました。<br>今回は追加したアイコンデータを検索できるように、Goで作成しているサーバーサイドの更新を行います。</p>



<h2 class="wp-block-heading">クエリの形式を変更する</h2>



<p>今まではQueryDSLを利用してクエリを構築していましたが、これをプログラムで作成しようとするとなかなか苦労しそうで、いい方法が思いつきませんでした。</p>



<p>ということで、今回から「Query String」という形式を利用してクエリを発行することにしました。<br><a href="https://opensearch.org/docs/latest/query-dsl/full-text/query-string/" target="_blank" rel="noreferrer noopener">https://opensearch.org/docs/latest/query-dsl/full-text/query-string/</a></p>



<p>この形式であればJSONの複雑な構造ではなく、シンプルな文字列でクエリを表現できそうだったため、この形式を利用することにしました。</p>



<h2 class="wp-block-heading">クエリ生成部分の修正</h2>



<div class="hcb_wrap"><pre class="prism line-numbers lang-plain"><code>	queryMainStr := `{
		&quot;size&quot;: 20,
		&quot;query&quot;: {
			&quot;query_string&quot;: {
				&quot;query&quot;: &quot;%s&quot;
			}
		}
	}`</code></pre></div>



<p>query_stringを利用し、%sの部分をクエリストリングに置き換える。<br>QueryDSLよりもシンプルにすることが出来ました。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-plain"><code>	queryStr := &quot;&quot;
	if searchRequest.Keyword != &quot;&quot; {
		queryStr += &quot;work_title:&quot; + searchRequest.Keyword
	}
	if searchRequest.AgeLimitType != &quot;&quot; {
		if queryStr != &quot;&quot; {
			queryStr += &quot; AND &quot;
		}
		queryStr += &quot;work_icons:&quot; + searchRequest.AgeLimitType
	}</code></pre></div>



<p>クエリ文字列を作成する部分です。<br>条件が2つしか存在しないので力技でANDをつけたりして組み立てています。<br>条件が今後増えてくれば、もう少しクエリ組み立て部分は考える必要が出てきそうですね。</p>



<p>組み立てたクエリは「fmt.Sprintf(クエリ文字列, クエリ式)」を利用して%sの部分を置き換えています。</p>



<h2 class="wp-block-heading">POSTMANから実行してみる</h2>



<p>POSTMANから実行してみます。<br>今回はクエリパラメータに条件を設定し、GETパラメータでサーバーに渡します。</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="332" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/08/20230819_001-1024x332.png" alt="" class="wp-image-849" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/08/20230819_001-1024x332.png 1024w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/08/20230819_001-300x97.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/08/20230819_001-768x249.png 768w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/08/20230819_001-1536x498.png 1536w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/08/20230819_001-2048x665.png 2048w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>実行した結果はこちらになります。</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="558" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/08/20230819_002-1024x558.png" alt="" class="wp-image-850" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/08/20230819_002-1024x558.png 1024w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/08/20230819_002-300x163.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/08/20230819_002-768x418.png 768w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/08/20230819_002-1536x837.png 1536w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/08/20230819_002.png 2008w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>query_stringを利用して検索結果を取得することが出来ました。</p>



<h2 class="wp-block-heading">以上です</h2>



<p>今回はサーバーサイドの改修を行いました。<br>次回はフロントエンドの開発に入ろうかと思います。</p>


<div id="rinkerid851" class="yyi-rinker-contents  yyi-rinker-postid-851 yyi-rinker-img-m yyi-rinker-catid-16 yyi-rinker-catid-18 ">
	<div class="yyi-rinker-box">
		<div class="yyi-rinker-image">
							<a href="https://af.moshimo.com/af/c/click?a_id=3394378&#038;p_id=54&#038;pc_id=54&#038;pl_id=616&#038;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FReact%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow"><img decoding="async" src="https://thumbnail.image.rakuten.co.jp/@0_mall/book/cabinet/9163/9784297129163_1_4.jpg?_ex=128x128" width="128" height="128" class="yyi-rinker-main-img" style="border: none;" loading="lazy"></a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</div>
		<div class="yyi-rinker-info">
			<div class="yyi-rinker-title">
									<a href="https://af.moshimo.com/af/c/click?a_id=3394378&#038;p_id=54&#038;pc_id=54&#038;pl_id=616&#038;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FReact%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow">TypeScriptとReact/Next.jsでつくる実践Webアプリケーション開発 [ 手島 拓也 ]</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">							</div>
			<div class="yyi-rinker-detail">
							<div class="credit-box">created by&nbsp;<a href="https://oyakosodate.com/rinker/" rel="nofollow noopener" target="_blank" >Rinker</a></div>
										<div class="price-box">
							<span title="" class="price">¥3,498</span>
															<span class="price_at">(2026/04/05 23:01:52時点&nbsp;楽天市場調べ-</span><span title="このサイトで掲載されている情報は当サイトの作成者により運営されています。価格、販売可能情報は、変更される場合があります。購入時に楽天市場店舗（www.rakuten.co.jp）に表示されている価格がその商品の販売に適用されます。">詳細)</span>
																	</div>
						</div>
						<ul class="yyi-rinker-links">
																                    <li class="amazonlink">
						<a href="https://www.amazon.co.jp/gp/search?ie=UTF8&amp;keywords=React&amp;tag=monodon-22&amp;index=blended&amp;linkCode=ure&amp;creative=6339" rel="nofollow" class="yyi-rinker-link">Amazon</a>					</li>
													<li class="rakutenlink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616&amp;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FReact%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow" class="yyi-rinker-link">楽天市場</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</li>
													<li class="yahoolink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502&amp;url=https%3A%2F%2Fshopping.yahoo.co.jp%2Fsearch%3Fp%3DReact" rel="nofollow" class="yyi-rinker-link">Yahooショッピング</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502" width="1" height="1" style="border:none;">					</li>
				                											</ul>
					</div>
	</div>
</div>


<div id="rinkerid514" class="yyi-rinker-contents  yyi-rinker-postid-514 yyi-rinker-img-m yyi-rinker-catid-16 yyi-rinker-catid-18 ">
	<div class="yyi-rinker-box">
		<div class="yyi-rinker-image">
							<a href="https://af.moshimo.com/af/c/click?a_id=3394378&#038;p_id=54&#038;pc_id=54&#038;pl_id=616&#038;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FGo%25E8%25A8%2580%25E8%25AA%259E%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow"><img decoding="async" src="https://thumbnail.image.rakuten.co.jp/@0_mall/book/cabinet/5196/9784297125196_1_3.jpg?_ex=128x128" width="128" height="128" class="yyi-rinker-main-img" style="border: none;" loading="lazy"></a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</div>
		<div class="yyi-rinker-info">
			<div class="yyi-rinker-title">
									<a href="https://af.moshimo.com/af/c/click?a_id=3394378&#038;p_id=54&#038;pc_id=54&#038;pl_id=616&#038;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FGo%25E8%25A8%2580%25E8%25AA%259E%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow">エキスパートたちのGo言語　一流のコードから応用力を学ぶ [ 上田 拓也 ]</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">							</div>
			<div class="yyi-rinker-detail">
							<div class="credit-box">created by&nbsp;<a href="https://oyakosodate.com/rinker/" rel="nofollow noopener" target="_blank" >Rinker</a></div>
										<div class="price-box">
							<span title="" class="price">¥3,278</span>
															<span class="price_at">(2026/04/05 23:21:47時点&nbsp;楽天市場調べ-</span><span title="このサイトで掲載されている情報は当サイトの作成者により運営されています。価格、販売可能情報は、変更される場合があります。購入時に楽天市場店舗（www.rakuten.co.jp）に表示されている価格がその商品の販売に適用されます。">詳細)</span>
																	</div>
						</div>
						<ul class="yyi-rinker-links">
																                    <li class="amazonlink">
						<a href="https://www.amazon.co.jp/gp/search?ie=UTF8&amp;keywords=Go%E8%A8%80%E8%AA%9E&amp;tag=monodon-22&amp;index=blended&amp;linkCode=ure&amp;creative=6339" rel="nofollow" class="yyi-rinker-link">Amazon</a>					</li>
													<li class="rakutenlink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616&amp;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FGo%25E8%25A8%2580%25E8%25AA%259E%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow" class="yyi-rinker-link">楽天市場</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</li>
													<li class="yahoolink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502&amp;url=https%3A%2F%2Fshopping.yahoo.co.jp%2Fsearch%3Fp%3DGo%25E8%25A8%2580%25E8%25AA%259E" rel="nofollow" class="yyi-rinker-link">Yahooショッピング</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502" width="1" height="1" style="border:none;">					</li>
				                											</ul>
					</div>
	</div>
</div>
<p>投稿 <a href="https://sheltie-garage.xyz/tech/2023/08/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9e%e3%81%9d%e3%81%ae6-%e3%82%a2%e3%82%a4%e3%82%b3%e3%83%b3%e3%83%87%e3%83%bc%e3%82%bf%e3%82%92%e6%a4%9c%e7%b4%a2%e5%87%ba/">OpenSearchでなにか作るぞ!(その6 アイコンデータを検索出来るようにサーバーサイドを修正する）</a> は <a href="https://sheltie-garage.xyz/tech">Sheltie Garage Tech</a> に最初に表示されました。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sheltie-garage.xyz/tech/2023/08/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9e%e3%81%9d%e3%81%ae6-%e3%82%a2%e3%82%a4%e3%82%b3%e3%83%b3%e3%83%87%e3%83%bc%e3%82%bf%e3%82%92%e6%a4%9c%e7%b4%a2%e5%87%ba/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>OpenSearchでなにか作るぞ!(その5 アイコンデータに対応させる）</title>
		<link>https://sheltie-garage.xyz/tech/2023/08/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9e%e3%81%9d%e3%81%ae5-%e3%82%a2%e3%82%a4%e3%82%b3%e3%83%b3%e3%83%87%e3%83%bc%e3%82%bf%e3%81%ab%e5%af%be%e5%bf%9c%e3%81%95/</link>
					<comments>https://sheltie-garage.xyz/tech/2023/08/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9e%e3%81%9d%e3%81%ae5-%e3%82%a2%e3%82%a4%e3%82%b3%e3%83%b3%e3%83%87%e3%83%bc%e3%82%bf%e3%81%ab%e5%af%be%e5%bf%9c%e3%81%95/#respond</comments>
		
		<dc:creator><![CDATA[monodon]]></dc:creator>
		<pubDate>Sun, 06 Aug 2023 08:18:31 +0000</pubDate>
				<category><![CDATA[Go]]></category>
		<category><![CDATA[OpenSearch]]></category>
		<guid isPermaLink="false">https://sheltie-garage.xyz/tech/?p=824</guid>

					<description><![CDATA[<p>前回までで一旦OpenSearchにドキュメントを登録するところまで出来ました。今回はカラムにArrayタイプのデータを登楼して、アイコン(DAnimeで言うR15+やレンタルなど)を検索出来るようにします。 OpenS [&#8230;]</p>
<p>投稿 <a href="https://sheltie-garage.xyz/tech/2023/08/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9e%e3%81%9d%e3%81%ae5-%e3%82%a2%e3%82%a4%e3%82%b3%e3%83%b3%e3%83%87%e3%83%bc%e3%82%bf%e3%81%ab%e5%af%be%e5%bf%9c%e3%81%95/">OpenSearchでなにか作るぞ!(その5 アイコンデータに対応させる）</a> は <a href="https://sheltie-garage.xyz/tech">Sheltie Garage Tech</a> に最初に表示されました。</p>
]]></description>
										<content:encoded><![CDATA[
<p>前回までで一旦OpenSearchにドキュメントを登録するところまで出来ました。<br>今回はカラムにArrayタイプのデータを登楼して、アイコン(DAnimeで言うR15+やレンタルなど)を検索出来るようにします。</p>



<h2 class="wp-block-heading">OpenSearchのMappingを改修する</h2>



<p>現在のマッピング定義にアイコン情報を格納するカラムが存在しないので、追加します。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-plain"><code>・・・省略
        &quot;end_of_delivery&quot;: {
        &quot;type&quot;: &quot;integer&quot;
        },
        &quot;work_icons&quot;:{　←これを追加
          &quot;type&quot; : &quot;keyword&quot;
        },
        &quot;created_at&quot;: {
        &quot;type&quot;: &quot;date&quot;
        },
        &quot;updated_at&quot;: {
        &quot;type&quot;: &quot;date&quot;
        }
・・・省略</code></pre></div>



<p>ちなみに、OpenSearchには「Array型」というものは存在しないようで、上記のように通常のカラムを追加し、登録時に配列でデータを渡すことで1カラムに複数データを格納できる仕様になっているみたいです。</p>



<h2 class="wp-block-heading">BulkInsertバッチを改修する</h2>



<p>マッピングが修正できたら、バルクインサートバッチを改修します。<br>DBに保存しているアイコン情報をgroup_condatでカンマ区切りで取得し、OpenSearch登録時にカンマ区切りから配列に変換して登録して見るようにしました。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-plain"><code>・・・省略
	&quot; ,IFNULL(group_concat(a_icon.work_icons), &#39;&#39;) AS work_icons &quot; +　←ここを追加
	&quot; ,a_list.created_at&quot; +
	&quot; ,a_list.updated_at&quot; +
	&quot; FROM d_anime.anime_list a_list &quot; +
	&quot; LEFT JOIN d_anime.work_icon a_icon &quot; +
	&quot; ON a_list.work_id = a_icon.work_id &quot; +
	&quot; GROUP BY a_list.work_id&quot;</code></pre></div>



<p>OpenSearch登録用の構造体を別途作成し、アイコン情報を配列に変換して渡してみます。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-plain"><code>・・・省略
		tmp.EndOfDelivery = result[i].EndOfDelivery
		if result[i].WorkIcons == &quot;&quot; {
			tmp.WorkIcons = []string{}　←データが無ければ、空の配列を設定
		} else {
			tmp.WorkIcons = strings.Split(result[i].WorkIcons, &quot;,&quot;) ← カンマ区切りから配列に変更
		}
		tmp.CreatedAt = result[i].CreatedAt
		tmp.UpdatedAt = result[i].UpdatedAt
・・・省略</code></pre></div>



<p>実際にバルクインサート用のデータを作成すると、以下のようになります。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-plain"><code>R15作品の例
{ &quot;index&quot; : { &quot;_index&quot; : &quot;d_anime&quot;, &quot;_id&quot; : &quot;7a26cf047bd32d6771cc68057834d37d15d30eee4dfc6d6e62bcb9450d7faff1&quot; } }
{&quot;work_id&quot;:24959,&quot;work_title&quot;:&quot;みこすり半劇場&quot;,&quot;link&quot;:&quot;https://animestore.docomo.ne.jp/animestore/ci?workId=24959&quot;,&quot;main_key_visual_path&quot;:&quot;https://cs1.animestore.docomo.ne.jp/anime_kv/img/24/95/9/24959_1_2.png?1627875034000&quot;,&quot;main_key_visual_alt&quot;:&quot;みこすり半劇場_2&quot;,&quot;my_list_count&quot;:2519,&quot;favorite_count&quot;:2644,&quot;age_limit_type&quot;:2,&quot;end_of_delivery&quot;:0,&quot;work_icons&quot;:[&quot;r15&quot;],&quot;created_at&quot;:&quot;2023-07-16T16:27:00+09:00&quot;,&quot;updated_at&quot;:&quot;2023-07-16T16:27:00+09:00&quot;}</code></pre></div>



<div class="hcb_wrap"><pre class="prism line-numbers lang-plain"><code>アイコン情報が無い作品の例
{ &quot;index&quot; : { &quot;_index&quot; : &quot;d_anime&quot;, &quot;_id&quot; : &quot;74b3114fda6e38fe1c36f5cbd0909c955d3e47d47fcf98d808075e3a8f4cbc5a&quot; } }
{&quot;work_id&quot;:24953,&quot;work_title&quot;:&quot;マギアレコード 魔法少女まどか☆マギカ外伝 Final SEASON –浅き夢の暁-&quot;,&quot;link&quot;:&quot;https://animestore.docomo.ne.jp/animestore/ci?workId=24953&quot;,&quot;main_key_visual_path&quot;:&quot;https://cs1.animestore.docomo.ne.jp/anime_kv/img/24/95/3/24953_1_2.png?1647568836875&quot;,&quot;main_key_visual_alt&quot;:&quot;マギアレコード 魔法少女まどか☆マギカ外伝 Final SEASON –浅き夢の暁-_2&quot;,&quot;my_list_count&quot;:12820,&quot;favorite_count&quot;:26865,&quot;age_limit_type&quot;:0,&quot;end_of_delivery&quot;:0,&quot;work_icons&quot;:[],&quot;created_at&quot;:&quot;2023-07-16T16:26:45+09:00&quot;,&quot;updated_at&quot;:&quot;2023-07-16T16:26:45+09:00&quot;}</code></pre></div>



<h2 class="wp-block-heading">検索を行い、確認する</h2>



<p>これでアイコン情報がインデックスに登録出来たので、検索出来るのか確認してみます。</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="482" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/08/20230806_001-1024x482.png" alt="" class="wp-image-825" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/08/20230806_001-1024x482.png 1024w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/08/20230806_001-300x141.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/08/20230806_001-768x362.png 768w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/08/20230806_001-1536x723.png 1536w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/08/20230806_001.png 1915w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>R15作品を検索したところ、18作品ヒットしました。そのうちの一つを実際のサイトで確認してみます。</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="979" height="607" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/08/20230806_002.png" alt="" class="wp-image-826" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/08/20230806_002.png 979w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/08/20230806_002-300x186.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/08/20230806_002-768x476.png 768w" sizes="auto, (max-width: 979px) 100vw, 979px" /></figure>



<p>土下座で頼んでみた　を確認したところ、きちんとR15指定の作品になっていました。<br>これで、レンタルや期間限定、R15作品を個別に検索するための下準備を作ることが出来ました。</p>



<p>R15作品については、本当に正しい検索結果になっているか検証が必要なので、本日はこのあたりで失礼します。</p>


<div id="rinkerid775" class="yyi-rinker-contents  yyi-rinker-postid-775 yyi-rinker-img-m yyi-rinker-catid-16 yyi-rinker-catid-18 ">
	<div class="yyi-rinker-box">
		<div class="yyi-rinker-image">
							<a href="https://www.amazon.co.jp/dp/B09BV2HGN3?tag=monodon-22&#038;linkCode=ogi&#038;th=1&#038;psc=1" rel="nofollow"><img decoding="async" src="https://m.media-amazon.com/images/I/51Y0-P+m94L._SL160_.jpg" width="112" height="160" class="yyi-rinker-main-img" style="border: none;" loading="lazy"></a>					</div>
		<div class="yyi-rinker-info">
			<div class="yyi-rinker-title">
									<a href="https://www.amazon.co.jp/dp/B09BV2HGN3?tag=monodon-22&#038;linkCode=ogi&#038;th=1&#038;psc=1" rel="nofollow">モダンJavaScriptの基本から始める　React実践の教科書　（最新ReactHooks対応）</a>							</div>
			<div class="yyi-rinker-detail">
							<div class="credit-box">created by&nbsp;<a href="https://oyakosodate.com/rinker/" rel="nofollow noopener" target="_blank" >Rinker</a></div>
										<div class="price-box">
							</div>
						</div>
						<ul class="yyi-rinker-links">
																	<li class="amazonkindlelink">
						<a href="https://www.amazon.co.jp/dp/B09BV2HGN3?tag=monodon-22&amp;linkCode=ogi&amp;th=1&amp;psc=1" rel="nofollow" class="yyi-rinker-link">Kindle</a>					</li>
								                    <li class="amazonlink">
						<a href="https://www.amazon.co.jp/gp/search?ie=UTF8&amp;keywords=react&amp;tag=monodon-22&amp;index=blended&amp;linkCode=ure&amp;creative=6339" rel="nofollow" class="yyi-rinker-link">Amazon</a>					</li>
													<li class="rakutenlink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616&amp;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2Freact%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow" class="yyi-rinker-link">楽天市場</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</li>
													<li class="yahoolink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502&amp;url=https%3A%2F%2Fshopping.yahoo.co.jp%2Fsearch%3Fp%3Dreact" rel="nofollow" class="yyi-rinker-link">Yahooショッピング</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502" width="1" height="1" style="border:none;">					</li>
				                											</ul>
					</div>
	</div>
</div>


<div id="rinkerid645" class="yyi-rinker-contents  yyi-rinker-postid-645 yyi-rinker-img-m yyi-rinker-catid-16 yyi-rinker-catid-18 ">
	<div class="yyi-rinker-box">
		<div class="yyi-rinker-image">
							<a href="https://af.moshimo.com/af/c/click?a_id=3394378&#038;p_id=54&#038;pc_id=54&#038;pl_id=616&#038;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FGo%25E8%25A8%2580%25E8%25AA%259E%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow"><img decoding="async" src="https://thumbnail.image.rakuten.co.jp/@0_mall/book/cabinet/9694/9784873119694_1_3.jpg?_ex=128x128" width="128" height="128" class="yyi-rinker-main-img" style="border: none;" loading="lazy"></a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</div>
		<div class="yyi-rinker-info">
			<div class="yyi-rinker-title">
									<a href="https://af.moshimo.com/af/c/click?a_id=3394378&#038;p_id=54&#038;pc_id=54&#038;pl_id=616&#038;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FGo%25E8%25A8%2580%25E8%25AA%259E%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow">実用 Go言語 システム開発の現場で知っておきたいアドバイス [ 渋川 よしき ]</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">							</div>
			<div class="yyi-rinker-detail">
							<div class="credit-box">created by&nbsp;<a href="https://oyakosodate.com/rinker/" rel="nofollow noopener" target="_blank" >Rinker</a></div>
										<div class="price-box">
							<span title="" class="price">¥3,960</span>
															<span class="price_at">(2026/04/05 22:52:40時点&nbsp;楽天市場調べ-</span><span title="このサイトで掲載されている情報は当サイトの作成者により運営されています。価格、販売可能情報は、変更される場合があります。購入時に楽天市場店舗（www.rakuten.co.jp）に表示されている価格がその商品の販売に適用されます。">詳細)</span>
																	</div>
						</div>
						<ul class="yyi-rinker-links">
																                    <li class="amazonlink">
						<a href="https://www.amazon.co.jp/gp/search?ie=UTF8&amp;keywords=Go%E8%A8%80%E8%AA%9E&amp;tag=monodon-22&amp;index=blended&amp;linkCode=ure&amp;creative=6339" rel="nofollow" class="yyi-rinker-link">Amazon</a>					</li>
													<li class="rakutenlink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616&amp;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FGo%25E8%25A8%2580%25E8%25AA%259E%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow" class="yyi-rinker-link">楽天市場</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</li>
													<li class="yahoolink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502&amp;url=https%3A%2F%2Fshopping.yahoo.co.jp%2Fsearch%3Fp%3DGo%25E8%25A8%2580%25E8%25AA%259E" rel="nofollow" class="yyi-rinker-link">Yahooショッピング</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502" width="1" height="1" style="border:none;">					</li>
				                											</ul>
					</div>
	</div>
</div>
<p>投稿 <a href="https://sheltie-garage.xyz/tech/2023/08/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9e%e3%81%9d%e3%81%ae5-%e3%82%a2%e3%82%a4%e3%82%b3%e3%83%b3%e3%83%87%e3%83%bc%e3%82%bf%e3%81%ab%e5%af%be%e5%bf%9c%e3%81%95/">OpenSearchでなにか作るぞ!(その5 アイコンデータに対応させる）</a> は <a href="https://sheltie-garage.xyz/tech">Sheltie Garage Tech</a> に最初に表示されました。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sheltie-garage.xyz/tech/2023/08/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9e%e3%81%9d%e3%81%ae5-%e3%82%a2%e3%82%a4%e3%82%b3%e3%83%b3%e3%83%87%e3%83%bc%e3%82%bf%e3%81%ab%e5%af%be%e5%bf%9c%e3%81%95/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>OpenSearchでなにか作るぞ!(dAnimeリメイク 番外編 バグ修正)</title>
		<link>https://sheltie-garage.xyz/tech/2023/07/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9edanime%e3%83%aa%e3%83%a1%e3%82%a4%e3%82%af-%e7%95%aa%e5%a4%96%e7%b7%a8-%e3%83%90%e3%82%b0%e4%bf%ae%e6%ad%a3/</link>
					<comments>https://sheltie-garage.xyz/tech/2023/07/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9edanime%e3%83%aa%e3%83%a1%e3%82%a4%e3%82%af-%e7%95%aa%e5%a4%96%e7%b7%a8-%e3%83%90%e3%82%b0%e4%bf%ae%e6%ad%a3/#respond</comments>
		
		<dc:creator><![CDATA[monodon]]></dc:creator>
		<pubDate>Sun, 23 Jul 2023 13:29:04 +0000</pubDate>
				<category><![CDATA[Go]]></category>
		<category><![CDATA[OpenSearch]]></category>
		<guid isPermaLink="false">https://sheltie-garage.xyz/tech/?p=816</guid>

					<description><![CDATA[<p>前回形態素解析にsudachiを導入しました。そのとき、データ再作成のためにbulk insertを実行したのですが、これが正しく動いていないことに気づいたので、こちらを修正していきます。 Work IDが正しく設定され [&#8230;]</p>
<p>投稿 <a href="https://sheltie-garage.xyz/tech/2023/07/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9edanime%e3%83%aa%e3%83%a1%e3%82%a4%e3%82%af-%e7%95%aa%e5%a4%96%e7%b7%a8-%e3%83%90%e3%82%b0%e4%bf%ae%e6%ad%a3/">OpenSearchでなにか作るぞ!(dAnimeリメイク 番外編 バグ修正)</a> は <a href="https://sheltie-garage.xyz/tech">Sheltie Garage Tech</a> に最初に表示されました。</p>
]]></description>
										<content:encoded><![CDATA[
<p>前回形態素解析にsudachiを導入しました。<br>そのとき、データ再作成のためにbulk insertを実行したのですが、これが正しく動いていないことに気づいたので、こちらを修正していきます。</p>



<h2 class="wp-block-heading">Work IDが正しく設定されていないことに気づく</h2>



<p>OpenSearch Dashboardからデータを確認したら、WorkIdが設定されていないことに気づきました。</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="601" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230723_001-1024x601.png" alt="" class="wp-image-817" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230723_001-1024x601.png 1024w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230723_001-300x176.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230723_001-768x451.png 768w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230723_001.png 1142w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>MySQLにはデータは正しく登録されているため、Go側の登録処理に問題があると思い処理を見直したところ、WorkIDが「文字列」として生成されており、OpenSearchに登録されていないことが分かりました。</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="830" height="192" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/202307023_002.png" alt="" class="wp-image-818" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/202307023_002.png 830w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/202307023_002-300x69.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/202307023_002-768x178.png 768w" sizes="auto, (max-width: 830px) 100vw, 830px" /></figure>



<h2 class="wp-block-heading">json,Marshalは構造体のデータ構造に基づいてJSONを生成する</h2>



<p>Bulk Insertを実行したときの大まかなデータの流れは以下の通り<br>DBよりデータ抽出→Goの構造体にデータを格納→json.Marshalを利用して構造体をJSONに変換→OpenSearchに登録</p>



<p>json.Marshalを実行したときに、int型で出力されてほしいデータがstringで出力されていたのでなんでかなと思ったら、構造体がstring型で定義されていただけという落ちでした。</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1000" height="342" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230723_003.png" alt="" class="wp-image-819" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230723_003.png 1000w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230723_003-300x103.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230723_003-768x263.png 768w" sizes="auto, (max-width: 1000px) 100vw, 1000px" /></figure>



<p>WorkIdのプロパティをintに変更することで、無事にint型として出力され、OpenSearch側にも登録されました。</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="758" height="204" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/スクリーンショット-2023-07-23-22.23.51.png" alt="" class="wp-image-820" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/スクリーンショット-2023-07-23-22.23.51.png 758w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/スクリーンショット-2023-07-23-22.23.51-300x81.png 300w" sizes="auto, (max-width: 758px) 100vw, 758px" /></figure>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="969" height="548" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230723_004.png" alt="" class="wp-image-821" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230723_004.png 969w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230723_004-300x170.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230723_004-768x434.png 768w" sizes="auto, (max-width: 969px) 100vw, 969px" /></figure>



<p>今更ながら、DB構造、Goの構造体、OpenSearchのインデックスそれぞれでデータ型を合わせておかないと変な場所でハマりますよという教訓でした。</p>


<div id="rinkerid645" class="yyi-rinker-contents  yyi-rinker-postid-645 yyi-rinker-img-m yyi-rinker-catid-16 yyi-rinker-catid-18 ">
	<div class="yyi-rinker-box">
		<div class="yyi-rinker-image">
							<a href="https://af.moshimo.com/af/c/click?a_id=3394378&#038;p_id=54&#038;pc_id=54&#038;pl_id=616&#038;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FGo%25E8%25A8%2580%25E8%25AA%259E%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow"><img decoding="async" src="https://thumbnail.image.rakuten.co.jp/@0_mall/book/cabinet/9694/9784873119694_1_3.jpg?_ex=128x128" width="128" height="128" class="yyi-rinker-main-img" style="border: none;" loading="lazy"></a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</div>
		<div class="yyi-rinker-info">
			<div class="yyi-rinker-title">
									<a href="https://af.moshimo.com/af/c/click?a_id=3394378&#038;p_id=54&#038;pc_id=54&#038;pl_id=616&#038;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FGo%25E8%25A8%2580%25E8%25AA%259E%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow">実用 Go言語 システム開発の現場で知っておきたいアドバイス [ 渋川 よしき ]</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">							</div>
			<div class="yyi-rinker-detail">
							<div class="credit-box">created by&nbsp;<a href="https://oyakosodate.com/rinker/" rel="nofollow noopener" target="_blank" >Rinker</a></div>
										<div class="price-box">
							<span title="" class="price">¥3,960</span>
															<span class="price_at">(2026/04/05 22:52:40時点&nbsp;楽天市場調べ-</span><span title="このサイトで掲載されている情報は当サイトの作成者により運営されています。価格、販売可能情報は、変更される場合があります。購入時に楽天市場店舗（www.rakuten.co.jp）に表示されている価格がその商品の販売に適用されます。">詳細)</span>
																	</div>
						</div>
						<ul class="yyi-rinker-links">
																                    <li class="amazonlink">
						<a href="https://www.amazon.co.jp/gp/search?ie=UTF8&amp;keywords=Go%E8%A8%80%E8%AA%9E&amp;tag=monodon-22&amp;index=blended&amp;linkCode=ure&amp;creative=6339" rel="nofollow" class="yyi-rinker-link">Amazon</a>					</li>
													<li class="rakutenlink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616&amp;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FGo%25E8%25A8%2580%25E8%25AA%259E%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow" class="yyi-rinker-link">楽天市場</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</li>
													<li class="yahoolink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502&amp;url=https%3A%2F%2Fshopping.yahoo.co.jp%2Fsearch%3Fp%3DGo%25E8%25A8%2580%25E8%25AA%259E" rel="nofollow" class="yyi-rinker-link">Yahooショッピング</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502" width="1" height="1" style="border:none;">					</li>
				                											</ul>
					</div>
	</div>
</div>


<div id="rinkerid546" class="yyi-rinker-contents  yyi-rinker-postid-546 yyi-rinker-img-m yyi-rinker-catid-16 yyi-rinker-catid-18 ">
	<div class="yyi-rinker-box">
		<div class="yyi-rinker-image">
							<a href="https://af.moshimo.com/af/c/click?a_id=3394378&#038;p_id=54&#038;pc_id=54&#038;pl_id=616&#038;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2F%25E5%2585%25A8%25E6%2596%2587%25E6%25A4%259C%25E7%25B4%25A2%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow"><img decoding="async" src="https://thumbnail.image.rakuten.co.jp/@0_mall/rakutenkobo-ebooks/cabinet/9422/2000005109422.jpg?_ex=128x128" width="128" height="128" class="yyi-rinker-main-img" style="border: none;" loading="lazy"></a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</div>
		<div class="yyi-rinker-info">
			<div class="yyi-rinker-title">
									<a href="https://af.moshimo.com/af/c/click?a_id=3394378&#038;p_id=54&#038;pc_id=54&#038;pl_id=616&#038;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2F%25E5%2585%25A8%25E6%2596%2587%25E6%25A4%259C%25E7%25B4%25A2%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow">［改訂第3版］Apache Solr入門 ーオープンソース全文検索エンジン【電子書籍】[ 打田智子(著) ]</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">							</div>
			<div class="yyi-rinker-detail">
							<div class="credit-box">created by&nbsp;<a href="https://oyakosodate.com/rinker/" rel="nofollow noopener" target="_blank" >Rinker</a></div>
										<div class="price-box">
							<span title="" class="price">¥4,180</span>
															<span class="price_at">(2026/04/05 23:14:41時点&nbsp;楽天市場調べ-</span><span title="このサイトで掲載されている情報は当サイトの作成者により運営されています。価格、販売可能情報は、変更される場合があります。購入時に楽天市場店舗（www.rakuten.co.jp）に表示されている価格がその商品の販売に適用されます。">詳細)</span>
																	</div>
						</div>
						<ul class="yyi-rinker-links">
																                    <li class="amazonlink">
						<a href="https://www.amazon.co.jp/gp/search?ie=UTF8&amp;keywords=%E5%85%A8%E6%96%87%E6%A4%9C%E7%B4%A2&amp;tag=monodon-22&amp;index=blended&amp;linkCode=ure&amp;creative=6339" rel="nofollow" class="yyi-rinker-link">Amazon</a>					</li>
													<li class="rakutenlink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616&amp;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2F%25E5%2585%25A8%25E6%2596%2587%25E6%25A4%259C%25E7%25B4%25A2%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow" class="yyi-rinker-link">楽天市場</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</li>
													<li class="yahoolink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502&amp;url=https%3A%2F%2Fshopping.yahoo.co.jp%2Fsearch%3Fp%3D%25E5%2585%25A8%25E6%2596%2587%25E6%25A4%259C%25E7%25B4%25A2" rel="nofollow" class="yyi-rinker-link">Yahooショッピング</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502" width="1" height="1" style="border:none;">					</li>
				                											</ul>
					</div>
	</div>
</div>
<p>投稿 <a href="https://sheltie-garage.xyz/tech/2023/07/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9edanime%e3%83%aa%e3%83%a1%e3%82%a4%e3%82%af-%e7%95%aa%e5%a4%96%e7%b7%a8-%e3%83%90%e3%82%b0%e4%bf%ae%e6%ad%a3/">OpenSearchでなにか作るぞ!(dAnimeリメイク 番外編 バグ修正)</a> は <a href="https://sheltie-garage.xyz/tech">Sheltie Garage Tech</a> に最初に表示されました。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sheltie-garage.xyz/tech/2023/07/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9edanime%e3%83%aa%e3%83%a1%e3%82%a4%e3%82%af-%e7%95%aa%e5%a4%96%e7%b7%a8-%e3%83%90%e3%82%b0%e4%bf%ae%e6%ad%a3/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>OpenSearchでなにか作るぞ!(dAnimeリメイク その4 日本語検索の向上を目指して)</title>
		<link>https://sheltie-garage.xyz/tech/2023/07/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9edanime%e3%83%aa%e3%83%a1%e3%82%a4%e3%82%af-%e3%81%9d%e3%81%ae3-%e6%97%a5%e6%9c%ac%e8%aa%9e%e6%a4%9c%e7%b4%a2%e3%81%ae/</link>
					<comments>https://sheltie-garage.xyz/tech/2023/07/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9edanime%e3%83%aa%e3%83%a1%e3%82%a4%e3%82%af-%e3%81%9d%e3%81%ae3-%e6%97%a5%e6%9c%ac%e8%aa%9e%e6%a4%9c%e7%b4%a2%e3%81%ae/#respond</comments>
		
		<dc:creator><![CDATA[monodon]]></dc:creator>
		<pubDate>Sun, 16 Jul 2023 09:05:05 +0000</pubDate>
				<category><![CDATA[Go]]></category>
		<category><![CDATA[OpenSearch]]></category>
		<guid isPermaLink="false">https://sheltie-garage.xyz/tech/?p=798</guid>

					<description><![CDATA[<p>前回まででざっくりとGoからOpenSearchに検索を行って、結果を取得するところまで実施してみました。 しかし、取得された結果はあまり納得行くものではなかったため、改めて日本語検索の精度が現時点で向上できないか試して [&#8230;]</p>
<p>投稿 <a href="https://sheltie-garage.xyz/tech/2023/07/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9edanime%e3%83%aa%e3%83%a1%e3%82%a4%e3%82%af-%e3%81%9d%e3%81%ae3-%e6%97%a5%e6%9c%ac%e8%aa%9e%e6%a4%9c%e7%b4%a2%e3%81%ae/">OpenSearchでなにか作るぞ!(dAnimeリメイク その4 日本語検索の向上を目指して)</a> は <a href="https://sheltie-garage.xyz/tech">Sheltie Garage Tech</a> に最初に表示されました。</p>
]]></description>
										<content:encoded><![CDATA[
<p>前回まででざっくりとGoからOpenSearchに検索を行って、結果を取得するところまで実施してみました。</p>



<p>しかし、取得された結果はあまり納得行くものではなかったため、改めて日本語検索の精度が現時点で向上できないか試してみます。<br>「ストライク」で検索して「ストライクウィッチーズ」が出てこないのは個人的にかなりまずい・・・</p>



<h2 class="wp-block-heading">kuromojiに変わる日本語形態素解析ライブラリ「sudachi」</h2>



<p>sudachiについてはこちらの記事で少し触れられていました。<br>https://techblog.zozo.com/entry/elasticsearch-mapping-config-for-japanese-search#kuromoji%E4%BB%A5%E5%A4%96%E3%81%AE%E6%97%A5%E6%9C%AC%E8%AA%9E%E5%BD%A2%E6%85%8B%E7%B4%A0%E8%A7%A3%E6%9E%90Sudachi</p>



<p>せっかくの趣味開発なので、あんまり前例が無いものも使っていきたいと思うので、sudachiを利用したときの結果を見てみようと思います。</p>



<p>GitHubにOpenSearch2.8.0用のプラグインも用意されているため、こちらを利用するようにします。<br>また、プラグイン本体以外にも辞書ファイルが必須のようで、そちらもインストールします。<br>辞書ファイルは事前にダウンロードして展開しておき、Dockerfileと同じ場所に保存しました。3種類ありますが、全て必要なようです。<br>辞書ファイルのダウンロードは以下のURLから行えます。<br><a href="https://github.com/WorksApplications/SudachiDict" target="_blank" rel="noreferrer noopener">https://github.com/WorksApplications/SudachiDict</a></p>



<p>参考に、sudachiをインストールしたときのDockerfileは以下の通りです。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-plain"><code>FROM opensearchproject/opensearch:2.8.0
RUN /usr/share/opensearch/bin/opensearch-plugin install analysis-kuromoji
RUN /usr/share/opensearch/bin/opensearch-plugin install analysis-icu
RUN /usr/share/opensearch/bin/opensearch-plugin install https://github.com/WorksApplications/elasticsearch-sudachi/releases/download/v3.1.0/opensearch-2.8.0-analysis-sudachi-3.1.0.zip
COPY system_core.dic /usr/share/opensearch/config/sudachi/
COPY system_small.dic /usr/share/opensearch/config/sudachi/
COPY system_full.dic /usr/share/opensearch/config/sudachi/</code></pre></div>



<h2 class="wp-block-heading">マッピングファイルの修正</h2>



<p>利用するアナライザが変わるため、マッピングファイルも修正します。<br>サンプルの設定をもとに、最低限の修正を加えてみます。<br><a href="https://github.com/WorksApplications/elasticsearch-sudachi" target="_blank" rel="noreferrer noopener">https://github.com/WorksApplications/elasticsearch-sudachi</a></p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-plain"><code>PUT d_anime
{
  &quot;settings&quot;: {
    &quot;analysis&quot;: {
      &quot;analyzer&quot;: {
        &quot;sudachi_analyzer&quot;: {
          &quot;filter&quot;: [],
          &quot;tokenizer&quot;: &quot;sudachi_tokenizer&quot;,
          &quot;type&quot;: &quot;custom&quot;
        }
      },
      &quot;tokenizer&quot;: {
        &quot;sudachi_tokenizer&quot;: {
          &quot;type&quot;: &quot;sudachi_tokenizer&quot;,
          &quot;split_mode&quot;: &quot;C&quot;,
          &quot;discard_punctuation&quot;: true,
          &quot;resources_path&quot;: &quot;/usr/share/opensearch/config/sudachi/&quot;
        }
      }
    }
  },
  &quot;mappings&quot;: {
      &quot;properties&quot;: {
        &quot;work_id&quot;: {
        &quot;type&quot;: &quot;integer&quot;
        },
        &quot;work_title&quot;: {
          &quot;type&quot;: &quot;text&quot;,
          &quot;analyzer&quot;: &quot;sudachi_analyzer&quot;,
          &quot;index&quot;: true
        },
        &quot;link&quot;: {
        &quot;type&quot;: &quot;keyword&quot;
        },
        &quot;main_key_visual_path&quot;: {
        &quot;type&quot;: &quot;keyword&quot;
        },
        &quot;main_key_visual_alt&quot;: {
        &quot;type&quot;: &quot;keyword&quot;
        },
        &quot;my_list_count&quot;: {
        &quot;type&quot;: &quot;integer&quot;
        },
        &quot;favorite_count&quot;: {
        &quot;type&quot;: &quot;integer&quot;
        },
        &quot;age_limit_type&quot;: {
        &quot;type&quot;: &quot;integer&quot;
        },
        &quot;end_of_delivery&quot;: {
        &quot;type&quot;: &quot;integer&quot;
        },
        &quot;created_at&quot;: {
        &quot;type&quot;: &quot;date&quot;
        },
        &quot;updated_at&quot;: {
        &quot;type&quot;: &quot;date&quot;
        }
      }
    }
  }
}</code></pre></div>



<h2 class="wp-block-heading">バルクインサートでデータ再作成</h2>



<p>上記で設定したインデックスに対して、再度アニメのデータを取り込んでみます。</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="462" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/os_20230716_001-1024x462.png" alt="" class="wp-image-800" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/os_20230716_001-1024x462.png 1024w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/os_20230716_001-300x135.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/os_20230716_001-768x346.png 768w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/os_20230716_001.png 1392w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">改めて「ストライク」でアナライズをかけてみる</h2>



<p>いきなりですが実行した結果がこちら。<br>ちゃんと「ストライク」「ウィッチーズ」で分割されています。</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="434" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/os_20230716_002-1024x434.png" alt="" class="wp-image-801" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/os_20230716_002-1024x434.png 1024w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/os_20230716_002-300x127.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/os_20230716_002-768x326.png 768w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/os_20230716_002.png 1144w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>前回作成したサーバーサイド(Go)からも実行してみます。</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="770" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/os_20230716_003-1024x770.png" alt="" class="wp-image-802" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/os_20230716_003-1024x770.png 1024w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/os_20230716_003-300x226.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/os_20230716_003-768x578.png 768w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/os_20230716_003-1536x1156.png 1536w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/os_20230716_003-2048x1541.png 2048w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>ストライクウィッチーズも検索結果に載ってきました！良かった！！</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="848" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/os_20230716_004-1024x848.png" alt="" class="wp-image-803" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/os_20230716_004-1024x848.png 1024w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/os_20230716_004-300x248.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/os_20230716_004-768x636.png 768w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/os_20230716_004-1536x1272.png 1536w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/os_20230716_004.png 1828w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>ストライクウィッチーズでもきちんとヒットします。<br>何もチューニングを行っていない状態で検索結果が改善されたので、導入の意義はあったかなと思います。<br>もうしばらく、現在の設定で検索結果が変な状態になっていないか確認したいと思います。</p>


<div id="rinkerid744" class="yyi-rinker-contents  yyi-rinker-postid-744 yyi-rinker-img-m yyi-rinker-catid-16 yyi-rinker-catid-18 ">
	<div class="yyi-rinker-box">
		<div class="yyi-rinker-image">
							<a href="https://www.amazon.co.jp/dp/B0B81PZY8H?tag=monodon-22&#038;linkCode=ogi&#038;th=1&#038;psc=1" rel="nofollow"><img decoding="async" src="https://m.media-amazon.com/images/I/51PtaFWLUBL._SL160_.jpg" width="112" height="160" class="yyi-rinker-main-img" style="border: none;" loading="lazy"></a>					</div>
		<div class="yyi-rinker-info">
			<div class="yyi-rinker-title">
									<a href="https://www.amazon.co.jp/dp/B0B81PZY8H?tag=monodon-22&#038;linkCode=ogi&#038;th=1&#038;psc=1" rel="nofollow">AWSの基本・仕組み・重要用語が全部わかる教科書 (見るだけ図解)</a>							</div>
			<div class="yyi-rinker-detail">
							<div class="credit-box">created by&nbsp;<a href="https://oyakosodate.com/rinker/" rel="nofollow noopener" target="_blank" >Rinker</a></div>
										<div class="price-box">
							</div>
						</div>
						<ul class="yyi-rinker-links">
																	<li class="amazonkindlelink">
						<a href="https://www.amazon.co.jp/dp/B0B81PZY8H?tag=monodon-22&amp;linkCode=ogi&amp;th=1&amp;psc=1" rel="nofollow" class="yyi-rinker-link">Kindle</a>					</li>
								                    <li class="amazonlink">
						<a href="https://www.amazon.co.jp/gp/search?ie=UTF8&amp;keywords=AWS&amp;tag=monodon-22&amp;index=blended&amp;linkCode=ure&amp;creative=6339" rel="nofollow" class="yyi-rinker-link">Amazon</a>					</li>
													<li class="rakutenlink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616&amp;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FAWS%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow" class="yyi-rinker-link">楽天市場</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</li>
													<li class="yahoolink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502&amp;url=https%3A%2F%2Fshopping.yahoo.co.jp%2Fsearch%3Fp%3DAWS" rel="nofollow" class="yyi-rinker-link">Yahooショッピング</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502" width="1" height="1" style="border:none;">					</li>
				                											</ul>
					</div>
	</div>
</div>


<div id="rinkerid554" class="yyi-rinker-contents  yyi-rinker-postid-554 yyi-rinker-img-m yyi-rinker-catid-16 yyi-rinker-catid-18 ">
	<div class="yyi-rinker-box">
		<div class="yyi-rinker-image">
							<a href="https://www.amazon.co.jp/dp/B00NUZ32MU?tag=monodon-22&#038;linkCode=ogi&#038;th=1&#038;psc=1" rel="nofollow"><img decoding="async" src="https://m.media-amazon.com/images/I/51FCcJCQTUL._SL160_.jpg" width="112" height="160" class="yyi-rinker-main-img" style="border: none;" loading="lazy"></a>					</div>
		<div class="yyi-rinker-info">
			<div class="yyi-rinker-title">
									<a href="https://www.amazon.co.jp/dp/B00NUZ32MU?tag=monodon-22&#038;linkCode=ogi&#038;th=1&#038;psc=1" rel="nofollow">検索エンジン自作入門～手を動かしながら見渡す検索の舞台裏</a>							</div>
			<div class="yyi-rinker-detail">
							<div class="credit-box">created by&nbsp;<a href="https://oyakosodate.com/rinker/" rel="nofollow noopener" target="_blank" >Rinker</a></div>
										<div class="price-box">
							</div>
						</div>
						<ul class="yyi-rinker-links">
																	<li class="amazonkindlelink">
						<a href="https://www.amazon.co.jp/dp/B00NUZ32MU?tag=monodon-22&amp;linkCode=ogi&amp;th=1&amp;psc=1" rel="nofollow" class="yyi-rinker-link">Kindle</a>					</li>
								                    <li class="amazonlink">
						<a href="https://www.amazon.co.jp/gp/search?ie=UTF8&amp;keywords=%E6%A4%9C%E7%B4%A2%E3%82%A8%E3%83%B3%E3%82%B8%E3%83%B3&amp;tag=monodon-22&amp;index=blended&amp;linkCode=ure&amp;creative=6339" rel="nofollow" class="yyi-rinker-link">Amazon</a>					</li>
													<li class="rakutenlink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616&amp;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2F%25E6%25A4%259C%25E7%25B4%25A2%25E3%2582%25A8%25E3%2583%25B3%25E3%2582%25B8%25E3%2583%25B3%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow" class="yyi-rinker-link">楽天市場</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</li>
													<li class="yahoolink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502&amp;url=https%3A%2F%2Fshopping.yahoo.co.jp%2Fsearch%3Fp%3D%25E6%25A4%259C%25E7%25B4%25A2%25E3%2582%25A8%25E3%2583%25B3%25E3%2582%25B8%25E3%2583%25B3" rel="nofollow" class="yyi-rinker-link">Yahooショッピング</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502" width="1" height="1" style="border:none;">					</li>
				                											</ul>
					</div>
	</div>
</div>
<p>投稿 <a href="https://sheltie-garage.xyz/tech/2023/07/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9edanime%e3%83%aa%e3%83%a1%e3%82%a4%e3%82%af-%e3%81%9d%e3%81%ae3-%e6%97%a5%e6%9c%ac%e8%aa%9e%e6%a4%9c%e7%b4%a2%e3%81%ae/">OpenSearchでなにか作るぞ!(dAnimeリメイク その4 日本語検索の向上を目指して)</a> は <a href="https://sheltie-garage.xyz/tech">Sheltie Garage Tech</a> に最初に表示されました。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sheltie-garage.xyz/tech/2023/07/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9edanime%e3%83%aa%e3%83%a1%e3%82%a4%e3%82%af-%e3%81%9d%e3%81%ae3-%e6%97%a5%e6%9c%ac%e8%aa%9e%e6%a4%9c%e7%b4%a2%e3%81%ae/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>OpenSearchでなにか作るぞ!(dAnimeリメイク その3)</title>
		<link>https://sheltie-garage.xyz/tech/2023/07/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9edanime%e3%83%aa%e3%83%a1%e3%82%a4%e3%82%af-%e3%81%9d%e3%81%ae3/</link>
					<comments>https://sheltie-garage.xyz/tech/2023/07/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9edanime%e3%83%aa%e3%83%a1%e3%82%a4%e3%82%af-%e3%81%9d%e3%81%ae3/#respond</comments>
		
		<dc:creator><![CDATA[monodon]]></dc:creator>
		<pubDate>Sat, 01 Jul 2023 14:36:46 +0000</pubDate>
				<category><![CDATA[OpenSearch]]></category>
		<guid isPermaLink="false">https://sheltie-garage.xyz/tech/?p=777</guid>

					<description><![CDATA[<p>前回までで一旦Go言語でOpenSearchに検索を行い、結果を取得するところまで作成しました。今回は検索条件として「キーワード」を設定できるように改修してみます。 検索クエリをどうやって組み立てる？ GoからOpenS [&#8230;]</p>
<p>投稿 <a href="https://sheltie-garage.xyz/tech/2023/07/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9edanime%e3%83%aa%e3%83%a1%e3%82%a4%e3%82%af-%e3%81%9d%e3%81%ae3/">OpenSearchでなにか作るぞ!(dAnimeリメイク その3)</a> は <a href="https://sheltie-garage.xyz/tech">Sheltie Garage Tech</a> に最初に表示されました。</p>
]]></description>
										<content:encoded><![CDATA[
<p>前回までで一旦Go言語でOpenSearchに検索を行い、結果を取得するところまで作成しました。<br>今回は検索条件として「キーワード」を設定できるように改修してみます。</p>



<h2 class="wp-block-heading">検索クエリをどうやって組み立てる？</h2>



<p>GoからOpenSearchに検索を行う時に頭を悩ませそうなのが「検索クエリをどうやって組み立てるか？」ということ。<br>個人的にOpenSearchのQueryDSLは構造が結構複雑かなと感じていて、複雑な条件が組み合わさった時に上手く条件を組み立てる方法がいまいち見つかっていません。</p>



<p>今回はキーワードのみ対応させるということで、「組み立てられたQueryDSLの文字列置換を行う」という方法で対応してみたいと思います。<br>具体的なGo言語のコードは以下の通り。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-plain"><code>	queryStr := `{
		&quot;size&quot;: 5,
		&quot;query&quot;: {
			&quot;match&quot;: {
				&quot;work_title&quot; : &quot;%s&quot;
			}
		}
	}`

	content := strings.NewReader(fmt.Sprintf(queryStr, searchRequest.Keyword))</code></pre></div>



<p>クエリ内に%sを仕込んでおき、Goのfmt.Sprintf関数で%sの部分にパラメータで渡ってきたキーワードを埋め込むというシンプルな方法です。<br>一旦これで上手くキーワード検索が実施できるか試してみましょう。</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="745" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230701_001-1024x745.png" alt="" class="wp-image-778" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230701_001-1024x745.png 1024w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230701_001-300x218.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230701_001-768x559.png 768w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230701_001-1536x1117.png 1536w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230701_001-2048x1490.png 2048w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>魔術で検索を行うと、作品タイトルに魔術を含むタイトルが複数ヒットしました。動作は問題なさそうです。</p>



<p>次は「ストライク」のキーワードで検索を行ってみました。</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="750" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230701_002-1024x750.png" alt="" class="wp-image-779" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230701_002-1024x750.png 1024w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230701_002-300x220.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230701_002-768x563.png 768w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230701_002-1536x1125.png 1536w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230701_002-2048x1500.png 2048w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>自分の好きな「ストライクウィッチーズ」シリーズがヒットしません。なぜでしょうか・・・？</p>



<h2 class="wp-block-heading">Analyzeを利用してキーワードの解析情報を確認する</h2>



<p>「ストライク」で検索した場合に「ストライクウィッチーズ」では検索できないのに、「ストライク・ザ・ブラッド」では正常に検索できました。<br>(今回の仕様はストライクで検索しても、ストライクウィッチーズが検索されてほしい)</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="524" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230701_003-1024x524.png" alt="" class="wp-image-780" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230701_003-1024x524.png 1024w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230701_003-300x153.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230701_003-768x393.png 768w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230701_003.png 1185w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>ストライク・ザ・ブラッドではちょどよくタイトルが分割されているのに対して</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="347" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230701_004-1024x347.png" alt="" class="wp-image-781" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230701_004-1024x347.png 1024w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230701_004-300x102.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230701_004-768x260.png 768w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/07/20230701_004.png 1235w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>ストライクウィッチーズでは分割されず、「ストライクウィッチーズ」のままインデックスに登録されたことが原因のようです。</p>



<p>kuromojiという日本語向けの形態素解析を利用していますが、あまり一般的ではない言葉を多く含むアニメのタイトルなどでは、その力をあまり発揮できないのかもしれません。</p>



<h2 class="wp-block-heading">次に向けて</h2>



<p>現状ではインデックスが上手く作成されず、検索にヒットすべきデータがヒットできていない状態なので、こちらの改善を目標に作業を進めて行こうと思います。</p>


<div id="rinkerid554" class="yyi-rinker-contents  yyi-rinker-postid-554 yyi-rinker-img-m yyi-rinker-catid-18 ">
	<div class="yyi-rinker-box">
		<div class="yyi-rinker-image">
							<a href="https://www.amazon.co.jp/dp/B00NUZ32MU?tag=monodon-22&#038;linkCode=ogi&#038;th=1&#038;psc=1" rel="nofollow"><img decoding="async" src="https://m.media-amazon.com/images/I/51FCcJCQTUL._SL160_.jpg" width="112" height="160" class="yyi-rinker-main-img" style="border: none;" loading="lazy"></a>					</div>
		<div class="yyi-rinker-info">
			<div class="yyi-rinker-title">
									<a href="https://www.amazon.co.jp/dp/B00NUZ32MU?tag=monodon-22&#038;linkCode=ogi&#038;th=1&#038;psc=1" rel="nofollow">検索エンジン自作入門～手を動かしながら見渡す検索の舞台裏</a>							</div>
			<div class="yyi-rinker-detail">
							<div class="credit-box">created by&nbsp;<a href="https://oyakosodate.com/rinker/" rel="nofollow noopener" target="_blank" >Rinker</a></div>
										<div class="price-box">
							</div>
						</div>
						<ul class="yyi-rinker-links">
																	<li class="amazonkindlelink">
						<a href="https://www.amazon.co.jp/dp/B00NUZ32MU?tag=monodon-22&amp;linkCode=ogi&amp;th=1&amp;psc=1" rel="nofollow" class="yyi-rinker-link">Kindle</a>					</li>
								                    <li class="amazonlink">
						<a href="https://www.amazon.co.jp/gp/search?ie=UTF8&amp;keywords=%E6%A4%9C%E7%B4%A2%E3%82%A8%E3%83%B3%E3%82%B8%E3%83%B3&amp;tag=monodon-22&amp;index=blended&amp;linkCode=ure&amp;creative=6339" rel="nofollow" class="yyi-rinker-link">Amazon</a>					</li>
													<li class="rakutenlink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616&amp;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2F%25E6%25A4%259C%25E7%25B4%25A2%25E3%2582%25A8%25E3%2583%25B3%25E3%2582%25B8%25E3%2583%25B3%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow" class="yyi-rinker-link">楽天市場</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</li>
													<li class="yahoolink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502&amp;url=https%3A%2F%2Fshopping.yahoo.co.jp%2Fsearch%3Fp%3D%25E6%25A4%259C%25E7%25B4%25A2%25E3%2582%25A8%25E3%2583%25B3%25E3%2582%25B8%25E3%2583%25B3" rel="nofollow" class="yyi-rinker-link">Yahooショッピング</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502" width="1" height="1" style="border:none;">					</li>
				                											</ul>
					</div>
	</div>
</div>


<div id="rinkerid542" class="yyi-rinker-contents  yyi-rinker-postid-542 yyi-rinker-img-m yyi-rinker-catid-18 ">
	<div class="yyi-rinker-box">
		<div class="yyi-rinker-image">
							<a href="https://af.moshimo.com/af/c/click?a_id=3394378&#038;p_id=54&#038;pc_id=54&#038;pl_id=616&#038;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FSolr%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow"><img decoding="async" src="https://thumbnail.image.rakuten.co.jp/@0_mall/book/cabinet/9307/9784774189307.jpg?_ex=128x128" width="128" height="128" class="yyi-rinker-main-img" style="border: none;" loading="lazy"></a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</div>
		<div class="yyi-rinker-info">
			<div class="yyi-rinker-title">
									<a href="https://af.moshimo.com/af/c/click?a_id=3394378&#038;p_id=54&#038;pc_id=54&#038;pl_id=616&#038;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FSolr%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow">Apache　Solr入門改訂第3版 オープンソース全文検索エンジン （Software　Design　plus　シリーズ） [ 打田智子 ]</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">							</div>
			<div class="yyi-rinker-detail">
							<div class="credit-box">created by&nbsp;<a href="https://oyakosodate.com/rinker/" rel="nofollow noopener" target="_blank" >Rinker</a></div>
										<div class="price-box">
							<span title="" class="price">¥4,180</span>
															<span class="price_at">(2026/04/05 23:20:12時点&nbsp;楽天市場調べ-</span><span title="このサイトで掲載されている情報は当サイトの作成者により運営されています。価格、販売可能情報は、変更される場合があります。購入時に楽天市場店舗（www.rakuten.co.jp）に表示されている価格がその商品の販売に適用されます。">詳細)</span>
																	</div>
						</div>
						<ul class="yyi-rinker-links">
																                    <li class="amazonlink">
						<a href="https://www.amazon.co.jp/gp/search?ie=UTF8&amp;keywords=Solr&amp;tag=monodon-22&amp;index=blended&amp;linkCode=ure&amp;creative=6339" rel="nofollow" class="yyi-rinker-link">Amazon</a>					</li>
													<li class="rakutenlink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616&amp;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FSolr%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow" class="yyi-rinker-link">楽天市場</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</li>
													<li class="yahoolink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502&amp;url=https%3A%2F%2Fshopping.yahoo.co.jp%2Fsearch%3Fp%3DSolr" rel="nofollow" class="yyi-rinker-link">Yahooショッピング</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502" width="1" height="1" style="border:none;">					</li>
				                											</ul>
					</div>
	</div>
</div>
<p>投稿 <a href="https://sheltie-garage.xyz/tech/2023/07/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9edanime%e3%83%aa%e3%83%a1%e3%82%a4%e3%82%af-%e3%81%9d%e3%81%ae3/">OpenSearchでなにか作るぞ!(dAnimeリメイク その3)</a> は <a href="https://sheltie-garage.xyz/tech">Sheltie Garage Tech</a> に最初に表示されました。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sheltie-garage.xyz/tech/2023/07/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9edanime%e3%83%aa%e3%83%a1%e3%82%a4%e3%82%af-%e3%81%9d%e3%81%ae3/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>OpenSearchでなにか作るぞ!(dAnimeリメイク その2)</title>
		<link>https://sheltie-garage.xyz/tech/2023/06/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9edanime%e3%83%aa%e3%83%a1%e3%82%a4%e3%82%af-%e3%81%9d%e3%81%ae2/</link>
					<comments>https://sheltie-garage.xyz/tech/2023/06/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9edanime%e3%83%aa%e3%83%a1%e3%82%a4%e3%82%af-%e3%81%9d%e3%81%ae2/#respond</comments>
		
		<dc:creator><![CDATA[monodon]]></dc:creator>
		<pubDate>Sat, 24 Jun 2023 07:37:19 +0000</pubDate>
				<category><![CDATA[Go]]></category>
		<category><![CDATA[OpenSearch]]></category>
		<guid isPermaLink="false">https://sheltie-garage.xyz/tech/?p=769</guid>

					<description><![CDATA[<p>前回まででスクレイピングとOpenSearchへの登録を作成しました。今回はサーバーサイド側の開発として、まずはOpenSearchへの接続部分を作成しようと思います。 Go + Echoの組み合わせ フロントから直接O [&#8230;]</p>
<p>投稿 <a href="https://sheltie-garage.xyz/tech/2023/06/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9edanime%e3%83%aa%e3%83%a1%e3%82%a4%e3%82%af-%e3%81%9d%e3%81%ae2/">OpenSearchでなにか作るぞ!(dAnimeリメイク その2)</a> は <a href="https://sheltie-garage.xyz/tech">Sheltie Garage Tech</a> に最初に表示されました。</p>
]]></description>
										<content:encoded><![CDATA[
<p>前回まででスクレイピングとOpenSearchへの登録を作成しました。<br>今回はサーバーサイド側の開発として、まずはOpenSearchへの接続部分を作成しようと思います。</p>



<h2 class="wp-block-heading">Go + Echoの組み合わせ</h2>



<p>フロントから直接OpenSearchに検索を行っても良い気がしますが、今回は間にGoを挟んで、検索条件の精査やフロントで扱いやすいようにレスポンスデータを整形したりする処理を行います。</p>



<h2 class="wp-block-heading">OpenSearchへの接続</h2>



<p>OpenSearchへの接続は以下のようにしてみました。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-plain"><code>// OpenSearchに接続する
func connectOpenSearch() (*opensearch.Client, error) {

	openSearch := os.Getenv(&quot;OPEN_SEARCH_SERVER&quot;)
	if openSearch == &quot;&quot; {
		openSearch = config.OPEN_SEARCH_SERVER
	}
	openSearchUser := os.Getenv(&quot;OPEN_SEARCH_USER&quot;)
	if openSearchUser == &quot;&quot; {
		openSearchUser = config.OPEN_SEARCH_USER
	}
	openSearchPassword := os.Getenv(&quot;OPEN_SEARCH_PASSWORD&quot;)
	if openSearchPassword == &quot;&quot; {
		openSearchPassword = config.OPEN_SEARCH_PASSWORD
	}

	client, err := opensearch.NewClient(opensearch.Config{
		Transport: &http.Transport{
			TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
		},
		Addresses: []string{openSearch},
		Username:  openSearchUser,
		Password:  openSearchPassword,
	})

	if err != nil {
		return nil, err
	}

	return client, nil
}</code></pre></div>



<p>OpenSearchのサンプルコードを、環境変数を利用するように置き換えただけですね。<br>os.Getenv()を利用することで、開発中はコンフィグファイルの設定を、本番環境では環境変数の値を利用する想定で作成しています。</p>



<p>OpenSearchのサンプルはこちら<br><a href="https://opensearch.org/docs/latest/clients/go/" target="_blank" rel="noreferrer noopener">https://opensearch.org/docs/latest/clients/go/</a></p>



<h2 class="wp-block-heading">クエリを実行し、レスポンスを取得する</h2>



<p>実際にクエリを実行し、レスポンスを取得します。<br>取得したレスポンスはjson.Unmarshalを利用して構造体に設定しました。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-plain"><code>// 検索を実行する
func Search(client *opensearch.Client) (result types.SearchResponse, err error) {

	content := strings.NewReader(`{
		&quot;size&quot;: 5,
		&quot;query&quot;: {
			&quot;match_all&quot;: {}
		  }
	}`)

	search := opensearchapi.SearchRequest{
		Index: []string{&quot;d_anime&quot;},
		Body:  content,
	}

	var res types.SearchResponse
	searchResponse, err := search.Do(context.Background(), client)
	if err != nil {
		return res, err
	}
	defer searchResponse.Body.Close()

	body, err := io.ReadAll(searchResponse.Body)
	if err != nil {
		return res, err
	}

	err = json.Unmarshal(body, &res)
	if err != nil {
		return res, err
	}

	return res, nil
}</code></pre></div>



<p>予めOpenSearchのレスポンスJSONからgoのstructを作成しておきます。<br>今回は<a href="https://transform.tools/json-to-go" target="_blank" rel="noreferrer noopener">これ</a>を使ってみました</p>



<p>今回はmatch allを利用したため全データ(うちの5件)が返ってきます。</p>



<p>少しハマったところとして、OpenSearchの検索結果のBodyはio.ReadAllで取得しないと中身が空っぽのように見えたので少し焦りました。</p>



<p>上記のプログラムのレスポンスは以下のようになります。</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="805" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230624_001-1024x805.png" alt="" class="wp-image-770" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230624_001-1024x805.png 1024w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230624_001-300x236.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230624_001-768x603.png 768w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230624_001-1536x1207.png 1536w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230624_001-2048x1609.png 2048w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p></p>



<h2 class="wp-block-heading">以上</h2>



<p>というところで、一旦goを利用してOpenSearchに検索がかけられたところまでにします。<br>次回は簡単な検索条件を指定し、その条件に基づいて検索を行えるように考えていこうと思います。</p>


<div id="rinkerid744" class="yyi-rinker-contents  yyi-rinker-postid-744 yyi-rinker-img-m yyi-rinker-catid-16 yyi-rinker-catid-18 ">
	<div class="yyi-rinker-box">
		<div class="yyi-rinker-image">
							<a href="https://www.amazon.co.jp/dp/B0B81PZY8H?tag=monodon-22&#038;linkCode=ogi&#038;th=1&#038;psc=1" rel="nofollow"><img decoding="async" src="https://m.media-amazon.com/images/I/51PtaFWLUBL._SL160_.jpg" width="112" height="160" class="yyi-rinker-main-img" style="border: none;" loading="lazy"></a>					</div>
		<div class="yyi-rinker-info">
			<div class="yyi-rinker-title">
									<a href="https://www.amazon.co.jp/dp/B0B81PZY8H?tag=monodon-22&#038;linkCode=ogi&#038;th=1&#038;psc=1" rel="nofollow">AWSの基本・仕組み・重要用語が全部わかる教科書 (見るだけ図解)</a>							</div>
			<div class="yyi-rinker-detail">
							<div class="credit-box">created by&nbsp;<a href="https://oyakosodate.com/rinker/" rel="nofollow noopener" target="_blank" >Rinker</a></div>
										<div class="price-box">
							</div>
						</div>
						<ul class="yyi-rinker-links">
																	<li class="amazonkindlelink">
						<a href="https://www.amazon.co.jp/dp/B0B81PZY8H?tag=monodon-22&amp;linkCode=ogi&amp;th=1&amp;psc=1" rel="nofollow" class="yyi-rinker-link">Kindle</a>					</li>
								                    <li class="amazonlink">
						<a href="https://www.amazon.co.jp/gp/search?ie=UTF8&amp;keywords=AWS&amp;tag=monodon-22&amp;index=blended&amp;linkCode=ure&amp;creative=6339" rel="nofollow" class="yyi-rinker-link">Amazon</a>					</li>
													<li class="rakutenlink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616&amp;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FAWS%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow" class="yyi-rinker-link">楽天市場</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</li>
													<li class="yahoolink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502&amp;url=https%3A%2F%2Fshopping.yahoo.co.jp%2Fsearch%3Fp%3DAWS" rel="nofollow" class="yyi-rinker-link">Yahooショッピング</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502" width="1" height="1" style="border:none;">					</li>
				                											</ul>
					</div>
	</div>
</div>


<div id="rinkerid645" class="yyi-rinker-contents  yyi-rinker-postid-645 yyi-rinker-img-m yyi-rinker-catid-16 yyi-rinker-catid-18 ">
	<div class="yyi-rinker-box">
		<div class="yyi-rinker-image">
							<a href="https://af.moshimo.com/af/c/click?a_id=3394378&#038;p_id=54&#038;pc_id=54&#038;pl_id=616&#038;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FGo%25E8%25A8%2580%25E8%25AA%259E%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow"><img decoding="async" src="https://thumbnail.image.rakuten.co.jp/@0_mall/book/cabinet/9694/9784873119694_1_3.jpg?_ex=128x128" width="128" height="128" class="yyi-rinker-main-img" style="border: none;" loading="lazy"></a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</div>
		<div class="yyi-rinker-info">
			<div class="yyi-rinker-title">
									<a href="https://af.moshimo.com/af/c/click?a_id=3394378&#038;p_id=54&#038;pc_id=54&#038;pl_id=616&#038;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FGo%25E8%25A8%2580%25E8%25AA%259E%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow">実用 Go言語 システム開発の現場で知っておきたいアドバイス [ 渋川 よしき ]</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">							</div>
			<div class="yyi-rinker-detail">
							<div class="credit-box">created by&nbsp;<a href="https://oyakosodate.com/rinker/" rel="nofollow noopener" target="_blank" >Rinker</a></div>
										<div class="price-box">
							<span title="" class="price">¥3,960</span>
															<span class="price_at">(2026/04/05 22:52:40時点&nbsp;楽天市場調べ-</span><span title="このサイトで掲載されている情報は当サイトの作成者により運営されています。価格、販売可能情報は、変更される場合があります。購入時に楽天市場店舗（www.rakuten.co.jp）に表示されている価格がその商品の販売に適用されます。">詳細)</span>
																	</div>
						</div>
						<ul class="yyi-rinker-links">
																                    <li class="amazonlink">
						<a href="https://www.amazon.co.jp/gp/search?ie=UTF8&amp;keywords=Go%E8%A8%80%E8%AA%9E&amp;tag=monodon-22&amp;index=blended&amp;linkCode=ure&amp;creative=6339" rel="nofollow" class="yyi-rinker-link">Amazon</a>					</li>
													<li class="rakutenlink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616&amp;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FGo%25E8%25A8%2580%25E8%25AA%259E%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow" class="yyi-rinker-link">楽天市場</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</li>
													<li class="yahoolink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502&amp;url=https%3A%2F%2Fshopping.yahoo.co.jp%2Fsearch%3Fp%3DGo%25E8%25A8%2580%25E8%25AA%259E" rel="nofollow" class="yyi-rinker-link">Yahooショッピング</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502" width="1" height="1" style="border:none;">					</li>
				                											</ul>
					</div>
	</div>
</div>
<p>投稿 <a href="https://sheltie-garage.xyz/tech/2023/06/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9edanime%e3%83%aa%e3%83%a1%e3%82%a4%e3%82%af-%e3%81%9d%e3%81%ae2/">OpenSearchでなにか作るぞ!(dAnimeリメイク その2)</a> は <a href="https://sheltie-garage.xyz/tech">Sheltie Garage Tech</a> に最初に表示されました。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sheltie-garage.xyz/tech/2023/06/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9edanime%e3%83%aa%e3%83%a1%e3%82%a4%e3%82%af-%e3%81%9d%e3%81%ae2/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>OpenSearchでなにか作るぞ!(dAnimeリメイク その1)</title>
		<link>https://sheltie-garage.xyz/tech/2023/06/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9edanime%e3%83%aa%e3%83%a1%e3%82%a4%e3%82%af-%e3%81%9d%e3%81%ae1/</link>
					<comments>https://sheltie-garage.xyz/tech/2023/06/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9edanime%e3%83%aa%e3%83%a1%e3%82%a4%e3%82%af-%e3%81%9d%e3%81%ae1/#respond</comments>
		
		<dc:creator><![CDATA[monodon]]></dc:creator>
		<pubDate>Sat, 17 Jun 2023 21:24:42 +0000</pubDate>
				<category><![CDATA[Go]]></category>
		<category><![CDATA[OpenSearch]]></category>
		<guid isPermaLink="false">https://sheltie-garage.xyz/tech/?p=763</guid>

					<description><![CDATA[<p>OpenSearchについて色々実験してきて、最低限日本語での検索が行えそうなので、そろそろアプリ開発に挑戦してみたいと思います。作るものは「dAnimeサーチ」のリメイクを行おうと思います dAnimeサーチとは？ 元 [&#8230;]</p>
<p>投稿 <a href="https://sheltie-garage.xyz/tech/2023/06/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9edanime%e3%83%aa%e3%83%a1%e3%82%a4%e3%82%af-%e3%81%9d%e3%81%ae1/">OpenSearchでなにか作るぞ!(dAnimeリメイク その1)</a> は <a href="https://sheltie-garage.xyz/tech">Sheltie Garage Tech</a> に最初に表示されました。</p>
]]></description>
										<content:encoded><![CDATA[
<p>OpenSearchについて色々実験してきて、最低限日本語での検索が行えそうなので、そろそろアプリ開発に挑戦してみたいと思います。<br>作るものは「dAnimeサーチ」のリメイクを行おうと思います</p>



<h2 class="wp-block-heading">dAnimeサーチとは？</h2>



<p>元々はkotlin + elasticsearchの練習と、R-15指定のアニメで絞り込みが行えないことに対する不満を改善するために作成したものです。</p>



<p>OpenSearchで作り直すに当たり、以下の技術スタックで行こうと思います。<br>・データ取得、登録ともにGo言語で行う（オリジナルはPythonで作りました）<br>・検索エンジンはもちろんOpenSearch<br>・フロントエンドはReact + NextJSで行う</p>



<h2 class="wp-block-heading">dAnimeデータ取得処理について</h2>



<p>スクレイピング処理もGo言語で記載します。と言っても、dAnimeの取扱情報はAPIで提供されておりJSON形式で取得できるので、スクレイピングというよりはAPI問い合わせ &amp; 取得情報のDB登録という処理になります。<br>dAnimeの規約をざっと見てみましたがプログラムを利用した作品情報の取得には触れられていないようなので、サーバー負荷がかからないように取得するようにしています。</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="439" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230618_001-1024x439.png" alt="" class="wp-image-764" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230618_001-1024x439.png 1024w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230618_001-300x129.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230618_001-768x329.png 768w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230618_001-1536x659.png 1536w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230618_001.png 1912w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">dAnimeのスキーマ設計について</h2>



<p>DB設計をもとにスキーマを作成し、OpenSearchのダッシュボードからインデックスを作成します。<br>作品タイトルのみ、kuromojiを利用した日本語アナライザを設定し、それ以外はintegerやkewordを利用したシンプルなものとしました</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="465" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230618_002-1024x465.png" alt="" class="wp-image-765" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230618_002-1024x465.png 1024w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230618_002-300x136.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230618_002-768x349.png 768w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230618_002.png 1475w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">BulkInsertバッチの作成</h2>



<p>DBから値を取得し、OpenSearchへバルクインサートを行うためのバッチを作成します。<br>バルクインサートの気をつける点として<br>・オペレーション、データ行それぞれで明示的に改行を入れる<br>・データの終端には改行を入れる<br>というのが挙げられます。</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="323" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230618_003-1024x323.png" alt="" class="wp-image-766" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230618_003-1024x323.png 1024w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230618_003-300x95.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230618_003-768x242.png 768w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230618_003-1536x485.png 1536w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230618_003.png 1926w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>上記例ではbulkInsertStr変数がバルクインサート用の文字列となっており、オペレーション、データ行ごとに明示的に\nの改行文字列を入れています</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="452" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230618_004-1024x452.png" alt="" class="wp-image-767" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230618_004-1024x452.png 1024w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230618_004-300x132.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230618_004-768x339.png 768w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230618_004-1536x678.png 1536w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230618_004.png 1857w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>バッチを実行すると5577行のデータがインサートされたため、もれなくOpenSearchへの登録は行えたようです。</p>



<h2 class="wp-block-heading">以上</h2>



<p>ということで、dAnimeサーチリメイクをめざして、ひとまずOpenSearchへのデータ登録までざっくりと説明させていただきました。<br>次からは実際にOpenSearchに検索をかけるためのサーバーサイド処理を考えていきたいと思います</p>


<div id="rinkerid645" class="yyi-rinker-contents  yyi-rinker-postid-645 yyi-rinker-img-m yyi-rinker-catid-16 yyi-rinker-catid-18 ">
	<div class="yyi-rinker-box">
		<div class="yyi-rinker-image">
							<a href="https://af.moshimo.com/af/c/click?a_id=3394378&#038;p_id=54&#038;pc_id=54&#038;pl_id=616&#038;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FGo%25E8%25A8%2580%25E8%25AA%259E%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow"><img decoding="async" src="https://thumbnail.image.rakuten.co.jp/@0_mall/book/cabinet/9694/9784873119694_1_3.jpg?_ex=128x128" width="128" height="128" class="yyi-rinker-main-img" style="border: none;" loading="lazy"></a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</div>
		<div class="yyi-rinker-info">
			<div class="yyi-rinker-title">
									<a href="https://af.moshimo.com/af/c/click?a_id=3394378&#038;p_id=54&#038;pc_id=54&#038;pl_id=616&#038;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FGo%25E8%25A8%2580%25E8%25AA%259E%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow">実用 Go言語 システム開発の現場で知っておきたいアドバイス [ 渋川 よしき ]</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">							</div>
			<div class="yyi-rinker-detail">
							<div class="credit-box">created by&nbsp;<a href="https://oyakosodate.com/rinker/" rel="nofollow noopener" target="_blank" >Rinker</a></div>
										<div class="price-box">
							<span title="" class="price">¥3,960</span>
															<span class="price_at">(2026/04/05 22:52:40時点&nbsp;楽天市場調べ-</span><span title="このサイトで掲載されている情報は当サイトの作成者により運営されています。価格、販売可能情報は、変更される場合があります。購入時に楽天市場店舗（www.rakuten.co.jp）に表示されている価格がその商品の販売に適用されます。">詳細)</span>
																	</div>
						</div>
						<ul class="yyi-rinker-links">
																                    <li class="amazonlink">
						<a href="https://www.amazon.co.jp/gp/search?ie=UTF8&amp;keywords=Go%E8%A8%80%E8%AA%9E&amp;tag=monodon-22&amp;index=blended&amp;linkCode=ure&amp;creative=6339" rel="nofollow" class="yyi-rinker-link">Amazon</a>					</li>
													<li class="rakutenlink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616&amp;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2FGo%25E8%25A8%2580%25E8%25AA%259E%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow" class="yyi-rinker-link">楽天市場</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</li>
													<li class="yahoolink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502&amp;url=https%3A%2F%2Fshopping.yahoo.co.jp%2Fsearch%3Fp%3DGo%25E8%25A8%2580%25E8%25AA%259E" rel="nofollow" class="yyi-rinker-link">Yahooショッピング</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502" width="1" height="1" style="border:none;">					</li>
				                											</ul>
					</div>
	</div>
</div>


<div id="rinkerid541" class="yyi-rinker-contents   yyi-rinker-postid-541 yyi-rinker-no-item">
	<div class="yyi-rinker-box">
		<div class="yyi-rinker-image"></div>
		<div class="yyi-rinker-info">
			<div class="yyi-rinker-title">
								スキルアップ！ 情報検索ー基本と実践　新訂第2版【電子書籍】[ 中島玲子 ]							</div>

			<div class="yyi-rinker-detail">
											</div>
						<ul class="yyi-rinker-links">
																	<li class="amazonlink">
						<a href="https://www.amazon.co.jp/gp/search?ie=UTF8&amp;keywords=%E6%A4%9C%E7%B4%A2&amp;tag=monodon-22&amp;index=blended&amp;linkCode=ure&amp;creative=6339" rel="nofollow" class="yyi-rinker-link">Amazon</a>					</li>
													<li class="rakutenlink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616&amp;url=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2F%25E6%25A4%259C%25E7%25B4%25A2%2F%3Ff%3D1%26grp%3Dproduct" rel="nofollow" class="yyi-rinker-link">楽天市場</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3394378&amp;p_id=54&amp;pc_id=54&amp;pl_id=616" width="1" height="1" style="border:none;">					</li>
													<li class="yahoolink">
						<a href="https://af.moshimo.com/af/c/click?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502&amp;url=https%3A%2F%2Fshopping.yahoo.co.jp%2Fsearch%3Fp%3D%25E6%25A4%259C%25E7%25B4%25A2" rel="nofollow" class="yyi-rinker-link">Yahooショッピング</a><img loading="lazy" decoding="async" src="https://i.moshimo.com/af/i/impression?a_id=3442618&amp;p_id=1225&amp;pc_id=1925&amp;pl_id=18502" width="1" height="1" style="border:none;">					</li>
				                											</ul>
					</div>
	</div>
	</div><p>投稿 <a href="https://sheltie-garage.xyz/tech/2023/06/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9edanime%e3%83%aa%e3%83%a1%e3%82%a4%e3%82%af-%e3%81%9d%e3%81%ae1/">OpenSearchでなにか作るぞ!(dAnimeリメイク その1)</a> は <a href="https://sheltie-garage.xyz/tech">Sheltie Garage Tech</a> に最初に表示されました。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sheltie-garage.xyz/tech/2023/06/opensearch%e3%81%a7%e3%81%aa%e3%81%ab%e3%81%8b%e4%bd%9c%e3%82%8b%e3%81%9edanime%e3%83%aa%e3%83%a1%e3%82%a4%e3%82%af-%e3%81%9d%e3%81%ae1/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>OpenSearch 日本語検索を実行してみる</title>
		<link>https://sheltie-garage.xyz/tech/2023/06/opensearch-%e6%97%a5%e6%9c%ac%e8%aa%9e%e6%a4%9c%e7%b4%a2%e3%82%92%e5%ae%9f%e8%a1%8c%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b/</link>
					<comments>https://sheltie-garage.xyz/tech/2023/06/opensearch-%e6%97%a5%e6%9c%ac%e8%aa%9e%e6%a4%9c%e7%b4%a2%e3%82%92%e5%ae%9f%e8%a1%8c%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b/#respond</comments>
		
		<dc:creator><![CDATA[monodon]]></dc:creator>
		<pubDate>Sun, 04 Jun 2023 08:28:47 +0000</pubDate>
				<category><![CDATA[OpenSearch]]></category>
		<guid isPermaLink="false">https://sheltie-garage.xyz/tech/?p=749</guid>

					<description><![CDATA[<p>前回作成した日本語インデックスに対してある程度ドキュメントを登録して、実際に日本語で検索をかけてみたいと思いますインデックスは前回作成したものを引き続き利用します もとになるデータについて ライトノベルのタイトルをいくつ [&#8230;]</p>
<p>投稿 <a href="https://sheltie-garage.xyz/tech/2023/06/opensearch-%e6%97%a5%e6%9c%ac%e8%aa%9e%e6%a4%9c%e7%b4%a2%e3%82%92%e5%ae%9f%e8%a1%8c%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b/">OpenSearch 日本語検索を実行してみる</a> は <a href="https://sheltie-garage.xyz/tech">Sheltie Garage Tech</a> に最初に表示されました。</p>
]]></description>
										<content:encoded><![CDATA[
<p>前回作成した日本語インデックスに対してある程度ドキュメントを登録して、実際に日本語で検索をかけてみたいと思います<br>インデックスは<a href="https://sheltie-garage.xyz/tech/2023/05/opensearch%e3%81%a7zozotown%e5%bc%8f%e6%97%a5%e6%9c%ac%e8%aa%9e%e6%a4%9c%e7%b4%a2%e8%a8%ad%e5%ae%9a%e3%82%92%e8%a9%a6%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b/" target="_blank" rel="noreferrer noopener">前回作成したも</a>のを引き続き利用します</p>



<h2 class="wp-block-heading">もとになるデータについて</h2>



<p>ライトノベルのタイトルをいくつかChatGPTで作って見ました<br>これをbulk insertにて先日作成したインデックスに流し込みます</p>



<p>テストデータ自体は長くなるため、本記事の最後に載せます<br>利用したい方がいたら、利用してください(魔法とか異世界とかがやたらと多い・・・)</p>



<h2 class="wp-block-heading">Bulk Insertで流し込み</h2>



<p>テストデータをBulk Insertで流し込みます<br>以下のリクエストを　Open Searchダッシュボードから実行します<br>Bulk Insertはスプレッドシートの数式などを利用して作るのが簡単そうでした<br>一応、こちらも本記事の最後に実行したリクエストを貼っておきます</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="317" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230604_001-1024x317.png" alt="" class="wp-image-750" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230604_001-1024x317.png 1024w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230604_001-300x93.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230604_001-768x238.png 768w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230604_001.png 1486w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">フルテキストクエリを実行してみよう</h2>



<p>以上でテストデータの挿入が終わったため、実際に検索を実行して見ます</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-json" data-lang="JSON"><code>GET books/_search
{
  &quot;query&quot;: {
    &quot;match&quot;: {
      &quot;book_title&quot;: &quot;チート&quot;
    }
  }
}</code></pre></div>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="468" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230604_002-1024x468.png" alt="" class="wp-image-751" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230604_002-1024x468.png 1024w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230604_002-300x137.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230604_002-768x351.png 768w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230604_002.png 1375w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>100個タイトルを作成した割には、チートを含むタイトルは一つだけになりました</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-plain"><code>GET books/_search
{
  &quot;query&quot;: {
    &quot;match&quot;: {
      &quot;book_title&quot;: &quot;ギルド&quot;
    }
  }
}</code></pre></div>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="476" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230604_003-1024x476.png" alt="" class="wp-image-752" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230604_003-1024x476.png 1024w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230604_003-300x139.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230604_003-768x357.png 768w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230604_003-1536x714.png 1536w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230604_003.png 1625w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>こちらは13件ヒット。件数的にも大丈夫そうです</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-plain"><code>GET books/_search
{
  &quot;query&quot;: {
    &quot;match&quot;: {
      &quot;book_title&quot;: &quot;の&quot;
    }
  }
}</code></pre></div>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="509" src="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230604_004-1024x509.png" alt="" class="wp-image-753" srcset="https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230604_004-1024x509.png 1024w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230604_004-300x149.png 300w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230604_004-768x381.png 768w, https://sheltie-garage.xyz/tech/wp-content/uploads/2023/06/20230604_004.png 1071w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>一方で「の」のような検索だとヒットしません<br>これは前回設定した「kuromoji_part_of_speechフィルタ(不要な品詞を削除)」が効いているためです</p>



<h2 class="wp-block-heading">以上</h2>



<p>簡単ですが日本語検索をいくつか試してみました<br>このままでも十分利用できそうですが、エイリアスやユーザー辞書でチューニングを施すことで、より便利に利用できるようになります<br>このあたりも設定を見ていきたいと思います</p>



<h2 class="wp-block-heading">ChatGPTが生成したテストデータ</h2>



<div class="hcb_wrap"><pre class="prism line-numbers lang-json" data-lang="JSON"><code>魔法使いの学園と禁忌の魔術師
異世界転生したら最強勇者だった件
剣と魔法の冒険者ギルド
魔王軍の英雄伝説
魔法科高校の天才魔術師
異世界でチート能力を手に入れた少年
魔剣士と闇の王国
学園のアイドルは異世界の騎士団長
魔法戦士アカデミーの秘密
神々の遺産と失われた聖剣
異世界転生したら魔導師だった件
魔石探索者の冒険譚
学園魔法士と古代魔法の謎
異世界召喚された勇者の物語
魔王城の迷宮と最強冒険者
魔法少女と妖精の国
異世界でスキルを極めた少年の冒険記
魔法戦士学園の栄光と陰謀
魔術師の見習いと封印の秘宝
異世界転生したら魔剣使いだった件
魔法王国と運命の約束
学園の美少女探偵と魔法の事件簿
魔導学院の天才魔法使い
異世界で冒険者ギルドを経営する話
魔法少女と魔界の戦士
異世界転生したら賢者だった件
魔術師の遺産と幻の書物
学園の妖精と禁断の魔術
魔法剣士アカデミーの伝説
異世界で魔導士ギルドを興した少年
魔法王国の誇りと英雄の証
学園の騎士団長と聖剣の守護者
魔法使いの見習いと禁断の魔法
異世界で召喚獣使いになった少年
魔法少女と闇の魔導師
異世界転生したら聖女だった件
魔法学園の秘密と魔法の遺跡
魔剣使いと魔王の復活
学園の魔術師と封印の聖剣
異世界で錬金術師ギルドを設立した話
魔法王国の誓いと運命の絆
学園の魔法少女と魔界の侵略者
魔法戦士と魔王の脅威
異世界転生したら忍者だった件
魔法使いの見習いと遺跡の秘宝
学園の冒険者ギルドと最強剣士
魔剣士と禁断の召喚魔法
異世界で魔術師ギルドを築いた少年
魔法学園の秘密と魔術の遺産
魔法剣士と闇の魔導王
異世界転生したら聖剣使いだった件
魔法戦士と封印の聖なる力
学園の魔術師と魔法の遺跡
異世界で召喚獣使いとなった少年
魔法少女と魔導の絆
異世界転生したら錬金術師だった件
魔法王国の遺産と神秘の書物
学園の魔導師と封印の聖剣
魔剣使いと魔王の復活
異世界で賢者ギルドを興した少年
魔法王国の使命と運命の約束
学園の魔法少女と闇の侵略者
魔法戦士と魔王の脅威
異世界転生したら忍者だった件
魔法使いの見習いと古代遺跡の秘宝
学園の冒険者ギルドと最強剣豪
魔剣士と禁断の召喚術
異世界で魔術師ギルドを築いた少年
魔法学園の秘密と魔術の遺産
魔法剣士と闇の魔導王
異世界転生したら聖剣使いだった件
魔法戦士と封印の聖なる力
学園の魔術師と魔法の遺跡
異世界で召喚獣使いとなった少年
魔法少女と魔導の絆
異世界転生したら錬金術師だった件
魔法王国の遺産と神秘の書物
学園の魔導師と封印の聖剣
魔剣使いと魔王の復活
異世界で賢者ギルドを興した少年
魔法王国の使命と運命の約束
学園の魔法少女と闇の侵略者
魔法戦士と魔王の脅威
異世界転生したら忍者だった件
魔法使いの見習いと古代遺跡の秘宝
学園の冒険者ギルドと最強剣豪
魔剣士と禁断の召喚術
異世界で魔術師ギルドを築いた少年
魔法学園の秘密と魔術の遺産
魔法剣士と闇の魔導王
異世界転生したら聖剣使いだった件
魔法戦士と封印の聖なる力
学園の魔術師と魔法の遺跡
異世界で召喚獣使いとなった少年
魔法少女と魔導の絆
異世界転生したら錬金術師だった件
魔法王国の遺産と神秘の書物
学園の魔導師と封印の聖剣
魔剣使いと魔王の復活
異世界で賢者ギルドを興した少年</code></pre></div>



<h2 class="wp-block-heading">Bulk Insertのリクエスト</h2>



<div class="hcb_wrap"><pre class="prism line-numbers lang-json" data-lang="JSON"><code>POST _bulk
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;1&quot; } }
{ &quot;book_title&quot;: &quot;魔法使いの学園と禁忌の魔術師&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;2&quot; } }
{ &quot;book_title&quot;: &quot;異世界転生したら最強勇者だった件&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;3&quot; } }
{ &quot;book_title&quot;: &quot;剣と魔法の冒険者ギルド&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;4&quot; } }
{ &quot;book_title&quot;: &quot;魔王軍の英雄伝説&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;5&quot; } }
{ &quot;book_title&quot;: &quot;魔法科高校の天才魔術師&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;6&quot; } }
{ &quot;book_title&quot;: &quot;異世界でチート能力を手に入れた少年&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;7&quot; } }
{ &quot;book_title&quot;: &quot;魔剣士と闇の王国&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;8&quot; } }
{ &quot;book_title&quot;: &quot;学園のアイドルは異世界の騎士団長&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;9&quot; } }
{ &quot;book_title&quot;: &quot;魔法戦士アカデミーの秘密&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;10&quot; } }
{ &quot;book_title&quot;: &quot;神々の遺産と失われた聖剣&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;11&quot; } }
{ &quot;book_title&quot;: &quot;異世界転生したら魔導師だった件&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;12&quot; } }
{ &quot;book_title&quot;: &quot;魔石探索者の冒険譚&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;13&quot; } }
{ &quot;book_title&quot;: &quot;学園魔法士と古代魔法の謎&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;14&quot; } }
{ &quot;book_title&quot;: &quot;異世界召喚された勇者の物語&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;15&quot; } }
{ &quot;book_title&quot;: &quot;魔王城の迷宮と最強冒険者&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;16&quot; } }
{ &quot;book_title&quot;: &quot;魔法少女と妖精の国&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;17&quot; } }
{ &quot;book_title&quot;: &quot;異世界でスキルを極めた少年の冒険記&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;18&quot; } }
{ &quot;book_title&quot;: &quot;魔法戦士学園の栄光と陰謀&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;19&quot; } }
{ &quot;book_title&quot;: &quot;魔術師の見習いと封印の秘宝&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;20&quot; } }
{ &quot;book_title&quot;: &quot;異世界転生したら魔剣使いだった件&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;21&quot; } }
{ &quot;book_title&quot;: &quot;魔法王国と運命の約束&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;22&quot; } }
{ &quot;book_title&quot;: &quot;学園の美少女探偵と魔法の事件簿&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;23&quot; } }
{ &quot;book_title&quot;: &quot;魔導学院の天才魔法使い&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;24&quot; } }
{ &quot;book_title&quot;: &quot;異世界で冒険者ギルドを経営する話&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;25&quot; } }
{ &quot;book_title&quot;: &quot;魔法少女と魔界の戦士&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;26&quot; } }
{ &quot;book_title&quot;: &quot;異世界転生したら賢者だった件&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;27&quot; } }
{ &quot;book_title&quot;: &quot;魔術師の遺産と幻の書物&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;28&quot; } }
{ &quot;book_title&quot;: &quot;学園の妖精と禁断の魔術&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;29&quot; } }
{ &quot;book_title&quot;: &quot;魔法剣士アカデミーの伝説&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;30&quot; } }
{ &quot;book_title&quot;: &quot;異世界で魔導士ギルドを興した少年&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;31&quot; } }
{ &quot;book_title&quot;: &quot;魔法王国の誇りと英雄の証&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;32&quot; } }
{ &quot;book_title&quot;: &quot;学園の騎士団長と聖剣の守護者&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;33&quot; } }
{ &quot;book_title&quot;: &quot;魔法使いの見習いと禁断の魔法&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;34&quot; } }
{ &quot;book_title&quot;: &quot;異世界で召喚獣使いになった少年&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;35&quot; } }
{ &quot;book_title&quot;: &quot;魔法少女と闇の魔導師&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;36&quot; } }
{ &quot;book_title&quot;: &quot;異世界転生したら聖女だった件&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;37&quot; } }
{ &quot;book_title&quot;: &quot;魔法学園の秘密と魔法の遺跡&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;38&quot; } }
{ &quot;book_title&quot;: &quot;魔剣使いと魔王の復活&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;39&quot; } }
{ &quot;book_title&quot;: &quot;学園の魔術師と封印の聖剣&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;40&quot; } }
{ &quot;book_title&quot;: &quot;異世界で錬金術師ギルドを設立した話&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;41&quot; } }
{ &quot;book_title&quot;: &quot;魔法王国の誓いと運命の絆&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;42&quot; } }
{ &quot;book_title&quot;: &quot;学園の魔法少女と魔界の侵略者&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;43&quot; } }
{ &quot;book_title&quot;: &quot;魔法戦士と魔王の脅威&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;44&quot; } }
{ &quot;book_title&quot;: &quot;異世界転生したら忍者だった件&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;45&quot; } }
{ &quot;book_title&quot;: &quot;魔法使いの見習いと遺跡の秘宝&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;46&quot; } }
{ &quot;book_title&quot;: &quot;学園の冒険者ギルドと最強剣士&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;47&quot; } }
{ &quot;book_title&quot;: &quot;魔剣士と禁断の召喚魔法&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;48&quot; } }
{ &quot;book_title&quot;: &quot;異世界で魔術師ギルドを築いた少年&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;49&quot; } }
{ &quot;book_title&quot;: &quot;魔法学園の秘密と魔術の遺産&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;50&quot; } }
{ &quot;book_title&quot;: &quot;魔法剣士と闇の魔導王&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;51&quot; } }
{ &quot;book_title&quot;: &quot;異世界転生したら聖剣使いだった件&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;52&quot; } }
{ &quot;book_title&quot;: &quot;魔法戦士と封印の聖なる力&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;53&quot; } }
{ &quot;book_title&quot;: &quot;学園の魔術師と魔法の遺跡&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;54&quot; } }
{ &quot;book_title&quot;: &quot;異世界で召喚獣使いとなった少年&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;55&quot; } }
{ &quot;book_title&quot;: &quot;魔法少女と魔導の絆&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;56&quot; } }
{ &quot;book_title&quot;: &quot;異世界転生したら錬金術師だった件&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;57&quot; } }
{ &quot;book_title&quot;: &quot;魔法王国の遺産と神秘の書物&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;58&quot; } }
{ &quot;book_title&quot;: &quot;学園の魔導師と封印の聖剣&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;59&quot; } }
{ &quot;book_title&quot;: &quot;魔剣使いと魔王の復活&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;60&quot; } }
{ &quot;book_title&quot;: &quot;異世界で賢者ギルドを興した少年&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;61&quot; } }
{ &quot;book_title&quot;: &quot;魔法王国の使命と運命の約束&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;62&quot; } }
{ &quot;book_title&quot;: &quot;学園の魔法少女と闇の侵略者&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;63&quot; } }
{ &quot;book_title&quot;: &quot;魔法戦士と魔王の脅威&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;64&quot; } }
{ &quot;book_title&quot;: &quot;異世界転生したら忍者だった件&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;65&quot; } }
{ &quot;book_title&quot;: &quot;魔法使いの見習いと古代遺跡の秘宝&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;66&quot; } }
{ &quot;book_title&quot;: &quot;学園の冒険者ギルドと最強剣豪&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;67&quot; } }
{ &quot;book_title&quot;: &quot;魔剣士と禁断の召喚術&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;68&quot; } }
{ &quot;book_title&quot;: &quot;異世界で魔術師ギルドを築いた少年&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;69&quot; } }
{ &quot;book_title&quot;: &quot;魔法学園の秘密と魔術の遺産&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;70&quot; } }
{ &quot;book_title&quot;: &quot;魔法剣士と闇の魔導王&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;71&quot; } }
{ &quot;book_title&quot;: &quot;異世界転生したら聖剣使いだった件&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;72&quot; } }
{ &quot;book_title&quot;: &quot;魔法戦士と封印の聖なる力&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;73&quot; } }
{ &quot;book_title&quot;: &quot;学園の魔術師と魔法の遺跡&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;74&quot; } }
{ &quot;book_title&quot;: &quot;異世界で召喚獣使いとなった少年&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;75&quot; } }
{ &quot;book_title&quot;: &quot;魔法少女と魔導の絆&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;76&quot; } }
{ &quot;book_title&quot;: &quot;異世界転生したら錬金術師だった件&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;77&quot; } }
{ &quot;book_title&quot;: &quot;魔法王国の遺産と神秘の書物&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;78&quot; } }
{ &quot;book_title&quot;: &quot;学園の魔導師と封印の聖剣&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;79&quot; } }
{ &quot;book_title&quot;: &quot;魔剣使いと魔王の復活&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;80&quot; } }
{ &quot;book_title&quot;: &quot;異世界で賢者ギルドを興した少年&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;81&quot; } }
{ &quot;book_title&quot;: &quot;魔法王国の使命と運命の約束&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;82&quot; } }
{ &quot;book_title&quot;: &quot;学園の魔法少女と闇の侵略者&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;83&quot; } }
{ &quot;book_title&quot;: &quot;魔法戦士と魔王の脅威&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;84&quot; } }
{ &quot;book_title&quot;: &quot;異世界転生したら忍者だった件&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;85&quot; } }
{ &quot;book_title&quot;: &quot;魔法使いの見習いと古代遺跡の秘宝&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;86&quot; } }
{ &quot;book_title&quot;: &quot;学園の冒険者ギルドと最強剣豪&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;87&quot; } }
{ &quot;book_title&quot;: &quot;魔剣士と禁断の召喚術&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;88&quot; } }
{ &quot;book_title&quot;: &quot;異世界で魔術師ギルドを築いた少年&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;89&quot; } }
{ &quot;book_title&quot;: &quot;魔法学園の秘密と魔術の遺産&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;90&quot; } }
{ &quot;book_title&quot;: &quot;魔法剣士と闇の魔導王&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;91&quot; } }
{ &quot;book_title&quot;: &quot;異世界転生したら聖剣使いだった件&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;92&quot; } }
{ &quot;book_title&quot;: &quot;魔法戦士と封印の聖なる力&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;93&quot; } }
{ &quot;book_title&quot;: &quot;学園の魔術師と魔法の遺跡&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;94&quot; } }
{ &quot;book_title&quot;: &quot;異世界で召喚獣使いとなった少年&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;95&quot; } }
{ &quot;book_title&quot;: &quot;魔法少女と魔導の絆&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;96&quot; } }
{ &quot;book_title&quot;: &quot;異世界転生したら錬金術師だった件&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;97&quot; } }
{ &quot;book_title&quot;: &quot;魔法王国の遺産と神秘の書物&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;98&quot; } }
{ &quot;book_title&quot;: &quot;学園の魔導師と封印の聖剣&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;99&quot; } }
{ &quot;book_title&quot;: &quot;魔剣使いと魔王の復活&quot; }
{ &quot;index&quot;: { &quot;_index&quot;: &quot;books&quot;, &quot;_id&quot;: &quot;100&quot; } }
{ &quot;book_title&quot;: &quot;異世界で賢者ギルドを興した少年&quot; }</code></pre></div>
<p>投稿 <a href="https://sheltie-garage.xyz/tech/2023/06/opensearch-%e6%97%a5%e6%9c%ac%e8%aa%9e%e6%a4%9c%e7%b4%a2%e3%82%92%e5%ae%9f%e8%a1%8c%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b/">OpenSearch 日本語検索を実行してみる</a> は <a href="https://sheltie-garage.xyz/tech">Sheltie Garage Tech</a> に最初に表示されました。</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sheltie-garage.xyz/tech/2023/06/opensearch-%e6%97%a5%e6%9c%ac%e8%aa%9e%e6%a4%9c%e7%b4%a2%e3%82%92%e5%ae%9f%e8%a1%8c%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
