Skip to content

COFFEE-BARA/be-book-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“š Checkbara

checkbara1 checkbara2 checkbara3 checkbara4


suwha yoonju yugyeong dayeon
๐Ÿผ์œ ์ˆ˜ํ™”๐Ÿผ ๐Ÿฑ์†ก์œค์ฃผ๐Ÿฑ ๐Ÿถํ˜„์œ ๊ฒฝ๐Ÿถ ๐Ÿค์–‘๋‹ค์—ฐ๐Ÿค
Server / Data / BE AI / Data / BE Infra / BE / FE BE / FE

๐Ÿ”Ž be-book-search

__-ezgif com-resize

๋ณธ ๋ ˆํฌ์˜ ๋ชฉํ‘œ๋Š” ์‚ฌ์šฉ์ž๊ฐ€ ๋”์šฑ ์ •ํ™•ํ•˜๊ณ  ๋น ๋ฅด๊ฒŒ ์›ํ•˜๋Š” ์ฑ…์„ ์ฐพ์„ ์ˆ˜ ์žˆ๋„๋ก ๊ฒ€์ƒ‰ ๊ธฐ๋Šฅ์„ ๊ณ ๋„ํ™”ํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ํ•œ๊ตญ์–ด ๋ฐ ์˜์–ด ์ œ๋ชฉ ๊ฒ€์ƒ‰๊ณผ ์ €์ž ๊ฒ€์ƒ‰์˜ ์ •ํ™•๋„์™€ ์„ฑ๋Šฅ์„ ํ–ฅ์ƒ์‹œํ‚ค๊ธฐ ์œ„ํ•œ ์—ฌ๋Ÿฌ ์ „๋žต์„ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.


๊ธฐ๋Šฅ ์†Œ๊ฐœ

๐Ÿ“• ์ œ๋ชฉ ๊ฒ€์ƒ‰์˜ ๊ณ ๋„ํ™”

  • ํ•œ๊ตญ์–ด ๊ฒ€์ƒ‰ ์ตœ์ ํ™”: nori_tokenizer์™€ ํ•„ํ„ฐ(nori_readingform, nori_part_of_speech)๋ฅผ ์ ์šฉํ•˜์—ฌ ํ•œ๊ตญ์–ด ๋ณตํ•ฉ์–ด๋ฅผ ํšจ๊ณผ์ ์œผ๋กœ ์ฒ˜๋ฆฌํ•˜๊ณ  ๊ฒ€์ƒ‰ ์ •ํ™•๋„๋ฅผ ๋†’์˜€์Šต๋‹ˆ๋‹ค.
  • ์˜์–ด ์ œ๋ชฉ ๊ฒ€์ƒ‰ ๊ฐ•ํ™”: ๋ชจ๋“  ์˜์–ด ์ œ๋ชฉ์— ๋Œ€ํ•œ ๋Œ€์†Œ๋ฌธ์ž ๊ตฌ๋ถ„ ์—†์ด ๊ฒ€์ƒ‰ํ•  ์ˆ˜ ์žˆ๋„๋ก lowercase_filter๋ฅผ ์ ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.
  • ์ปค์Šคํ…€ ๋ถ„์„๊ธฐ ์ ์šฉ: ์ด๋Ÿฌํ•œ ์„ค์ •์„ ํฌํ•จํ•œ ์ปค์Šคํ…€ ๋ถ„์„๊ธฐ๋ฅผ ์ œ๋ชฉ ํ•„๋“œ์— ์ ์šฉํ•˜์—ฌ, ์ œ๋ชฉ ๊ฒ€์ƒ‰ ๊ธฐ๋Šฅ์„ ๊ณ ๋„ํ™”ํ–ˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ“™ ์ €์ž ๊ฒ€์ƒ‰์˜ ๊ณ ๋„ํ™”

  • ๋ถ€๋ถ„ ์ผ์น˜ ๊ฒ€์ƒ‰ ๊ฐ€๋Šฅ: edge_ngram_filter๋ฅผ ์ ์šฉํ•˜์—ฌ ์ €์ž ์ด๋ฆ„์˜ ๋ถ€๋ถ„ ์ผ์น˜ ๊ฒ€์ƒ‰์„ ๊ฐ€๋Šฅํ•˜๊ฒŒ ํ–ˆ์Šต๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž๋Š” ์ฟผ๋ฆฌ์˜ ์ผ๋ถ€๋งŒ์œผ๋กœ๋„ ์ €์ž๋ฅผ ๊ฒ€์ƒ‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ๋Œ€์†Œ๋ฌธ์ž ๊ตฌ๋ถ„ ์—†๋Š” ๊ฒ€์ƒ‰: ์ €์ž ๊ฒ€์ƒ‰ ์‹œ ๋Œ€์†Œ๋ฌธ์ž๋ฅผ ๊ตฌ๋ถ„ํ•˜์ง€ ์•Š๋„๋ก lowercase_filter๋ฅผ ์ ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ“— ๊ฒ€์ƒ‰ ์‹œ์Šคํ…œ์˜ ์„ฑ๋Šฅ ์ตœ์ ํ™”

  • ๋ฐฑ์—”๋“œ ์„ฑ๋Šฅ ํ–ฅ์ƒ: ๊ฒ€์ƒ‰ ์‹œ์Šคํ…œ์˜ ๋ฐฑ์—”๋“œ๋ฅผ Go ์–ธ์–ด๋กœ ์ž‘์„ฑํ•˜์—ฌ ํ”„๋ก ํŠธ์—”๋“œ์™€์˜ ํ†ต์‹  ์‹œ๊ฐ„์„ ๋Œ€ํญ ์ค„์˜€์Šต๋‹ˆ๋‹ค. Go์˜ ๋น ๋ฅธ ์‹คํ–‰ ์†๋„ ๋•๋ถ„์— ๊ธฐ์กด ์‹œ์Šคํ…œ ๋Œ€๋น„ ํ†ต์‹  ์‹œ๊ฐ„์„ ์ตœ๋Œ€ 5๋ฐฐ๊นŒ์ง€ ๋‹จ์ถ•ํ–ˆ์Šต๋‹ˆ๋‹ค.
  • ๋น ๋ฅธ ๋ฐ˜์‘ ์‹œ๊ฐ„: ์ด๋กœ ์ธํ•ด ์‚ฌ์šฉ์ž๋Š” ๋” ๋น ๋ฅธ ๋ฐ˜์‘ ์‹œ๊ฐ„์œผ๋กœ ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ๋ฅผ ๋ฐ›์•„๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ๋ณตํ•ฉ ์ฟผ๋ฆฌ ๊ฒ€์ƒ‰: multi_match ์ฟผ๋ฆฌ๋ฅผ ํ™œ์šฉํ•˜์—ฌ ์‚ฌ์šฉ์ž๊ฐ€ ์ œ๋ชฉ๊ณผ ์ €์ž๋ฅผ ๋™์‹œ์— ๊ฒ€์ƒ‰ํ•  ์ˆ˜ ์žˆ๋Š” ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

๊ฒฐ๊ณผ์ ์œผ๋กœ ์ด๋Ÿฌํ•œ ๊ณ ๋„ํ™” ์ž‘์—…์„ ํ†ตํ•ด ์‚ฌ์šฉ์ž ๊ฒฝํ—˜์„ ๋Œ€ํญ ํ–ฅ์ƒ์‹œํ‚ค๊ณ , ์›ํ•˜๋Š” ์ฑ…์„ ๋”์šฑ ๋น ๋ฅด๊ณ  ์ •ํ™•ํ•˜๊ฒŒ ์ฐพ์„ ์ˆ˜ ์žˆ๋Š” ๊ฒ€์ƒ‰ ์‹œ์Šคํ…œ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.



๐Ÿ“ย Elastic index

book-index mapping
// book-index mapping

{
  "mappings": {
    "properties": {
      "Author": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "text",
            "analyzer": "author_analyzer"
          },
          "partial": {
            "type": "text",
            "analyzer": "edge_ngram_analyzer"
          }
        }
      },
      "DetailCategory": {
        "type": "keyword"
      },
      "ISBN": {
        "type": "keyword"
      },
      "ImageURL": {
        "type": "keyword"
      },
      "IndexContent": {
        "type": "text"
      },
      "Introduction": {
        "type": "text"
      },
      "MiddleCategory": {
        "type": "keyword"
      },
      "Price": {
        "type": "integer"
      },
      "PubDate": {
        "type": "date",
        "format": "yyyy-MM-dd"
      },
      "Publisher": {
        "type": "keyword"
      },
      "PublisherReview": {
        "type": "text"
      },
      "PurchaseURL": {
        "type": "keyword"
      },
      "Search": {
        "type": "text"
      },
      "Title": {
        "type": "text",
        "analyzer": "title_analyzer"
      },
      "Vector": {
        "type": "dense_vector",
        "dims": 768,
        "index": true,
        "similarity": "cosine"
      },
      "document": {
        "type": "object"
      },
      "id": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "index": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "pipeline": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      }
    }
  }
}

book-index settings
//book -index settings
{
  "settings": {
    "index": {
      "routing": {
        "allocation": {
          "include": {
            "_tier_preference": "data_content"
          }
        }
      },
      "number_of_shards": "1",
      "provided_name": "book-index",
      "creation_date": "1708182319595",
      "analysis": {
        "filter": {
          "lowercase_filter": {
            "type": "lowercase"
          },
          "edge_ngram_filter": {
            "type": "edge_ngram",
            "min_gram": "1",
            "max_gram": "10"
          }
        },
        "analyzer": {
          "edge_ngram_analyzer": {
            "filter": [
              "edge_ngram_filter",
              "lowercase_filter"
            ],
            "type": "custom",
            "tokenizer": "nori_tokenizer_mine"
          },
          "author_analyzer": {
            "filter": [
              "lowercase_filter"
            ],
            "type": "custom",
            "tokenizer": "keyword"
          },
          "title_analyzer": {
            "filter": [
              "nori_readingform",
              "lowercase_filter",
              "nori_part_of_speech"
            ],
            "type": "custom",
            "tokenizer": "nori_tokenizer_mine"
          }
        },
        "tokenizer": {
          "nori_tokenizer_mine": {
            "type": "nori_tokenizer",
            "decompound_mode": "mixed"
          }
        }
      },
      "number_of_replicas": "2",
      "uuid": "okUbOg_pTJKVG2WO7e3rYQ",
      "version": {
        "created": "8500003"
      }
    }
  },
  "defaults": {
    "index": {
      "flush_after_merge": "512mb",
      "time_series": {
        "end_time": "9999-12-31T23:59:59.999Z",
        "start_time": "-9999-01-01T00:00:00Z",
        "es87tsdb_codec": {
          "enabled": "true"
        }
      },
      "final_pipeline": "_none",
      "max_inner_result_window": "100",
      "unassigned": {
        "node_left": {
          "delayed_timeout": "1m"
        }
      },
      "max_terms_count": "65536",
      "rollup": {
        "source": {
          "name": "",
          "uuid": ""
        }
      },
      "lifecycle": {
        "prefer_ilm": "true",
        "rollover_alias": "",
        "origination_date": "-1",
        "name": "",
        "parse_origination_date": "false",
        "step": {
          "wait_time_threshold": "12h"
        },
        "indexing_complete": "false"
      },
      "mode": "standard",
      "routing_partition_size": "1",
      "force_memory_term_dictionary": "false",
      "max_docvalue_fields_search": "100",
      "merge": {
        "scheduler": {
          "max_thread_count": "1",
          "auto_throttle": "true",
          "max_merge_count": "6"
        },
        "policy": {
          "merge_factor": "32",
          "floor_segment": "2mb",
          "max_merge_at_once_explicit": "30",
          "max_merge_at_once": "10",
          "max_merged_segment": "0b",
          "expunge_deletes_allowed": "10.0",
          "segments_per_tier": "10.0",
          "type": "UNSET",
          "deletes_pct_allowed": "20.0"
        }
      },
      "max_refresh_listeners": "1000",
      "max_regex_length": "1000",
      "load_fixed_bitset_filters_eagerly": "true",
      "number_of_routing_shards": "1",
      "write": {
        "wait_for_active_shards": "1"
      },
      "verified_before_close": "false",
      "mapping": {
        "coerce": "false",
        "nested_fields": {
          "limit": "50"
        },
        "depth": {
          "limit": "20"
        },
        "field_name_length": {
          "limit": "9223372036854775807"
        },
        "total_fields": {
          "limit": "1000"
        },
        "nested_objects": {
          "limit": "10000"
        },
        "ignore_malformed": "false",
        "dimension_fields": {
          "limit": "21"
        }
      },
      "source_only": "false",
      "soft_deletes": {
        "enabled": "true",
        "retention": {
          "operations": "0"
        },
        "retention_lease": {
          "period": "12h"
        }
      },
      "max_script_fields": "32",
      "query": {
        "default_field": [
          "*"
        ],
        "parse": {
          "allow_unmapped_fields": "true"
        }
      },
      "format": "0",
      "frozen": "false",
      "sort": {
        "missing": [],
        "mode": [],
        "field": [],
        "order": []
      },
      "priority": "1",
      "routing_path": [],
      "version": {
        "compatibility": "8500003"
      },
      "codec": "default",
      "max_rescore_window": "10000",
      "bloom_filter_for_id_field": {
        "enabled": "true"
      },
      "max_adjacency_matrix_filters": "100",
      "analyze": {
        "max_token_count": "10000"
      },
      "gc_deletes": "60s",
      "top_metrics_max_size": "10",
      "optimize_auto_generated_id": "true",
      "max_ngram_diff": "1",
      "hidden": "false",
      "translog": {
        "flush_threshold_age": "1m",
        "generation_threshold_size": "64mb",
        "flush_threshold_size": "10gb",
        "sync_interval": "5s",
        "retention": {
          "size": "-1",
          "age": "-1"
        },
        "durability": "REQUEST"
      },
      "auto_expand_replicas": "false",
      "fast_refresh": "false",
      "recovery": {
        "type": ""
      },
      "requests": {
        "cache": {
          "enable": "true"
        }
      },
      "data_path": "",
      "highlight": {
        "max_analyzed_offset": "1000000",
        "weight_matches_mode": {
          "enabled": "true"
        }
      },
      "look_back_time": "2h",
      "routing": {
        "rebalance": {
          "enable": "all"
        },
        "allocation": {
          "disk": {
            "watermark": {
              "ignore": "false"
            }
          },
          "enable": "all",
          "total_shards_per_node": "-1"
        }
      },
      "search": {
        "slowlog": {
          "level": "TRACE",
          "threshold": {
            "fetch": {
              "warn": "-1",
              "trace": "-1",
              "debug": "-1",
              "info": "-1"
            },
            "query": {
              "warn": "-1",
              "trace": "-1",
              "debug": "-1",
              "info": "-1"
            }
          }
        },
        "idle": {
          "after": "30s"
        },
        "throttled": "false"
      },
      "fielddata": {
        "cache": "node"
      },
      "look_ahead_time": "2h",
      "default_pipeline": "_none",
      "max_slices_per_scroll": "1024",
      "shard": {
        "check_on_startup": "false"
      },
      "xpack": {
        "watcher": {
          "template": {
            "version": ""
          }
        },
        "version": "",
        "ccr": {
          "following_index": "false"
        }
      },
      "percolator": {
        "map_unmapped_fields_as_text": "false"
      },
      "allocation": {
        "max_retries": "5",
        "existing_shards_allocator": "gateway_allocator"
      },
      "refresh_interval": "1s",
      "indexing": {
        "slowlog": {
          "reformat": "true",
          "threshold": {
            "index": {
              "warn": "-1",
              "trace": "-1",
              "debug": "-1",
              "info": "-1"
            }
          },
          "source": "1000",
          "level": "TRACE"
        }
      },
      "compound_format": "1gb",
      "blocks": {
        "metadata": "false",
        "read": "false",
        "read_only_allow_delete": "false",
        "read_only": "false",
        "write": "false"
      },
      "max_result_window": "10000",
      "store": {
        "stats_refresh_interval": "10s",
        "type": "",
        "fs": {
          "fs_lock": "native"
        },
        "preload": [],
        "snapshot": {
          "snapshot_name": "",
          "index_uuid": "",
          "cache": {
            "prewarm": {
              "enabled": "true"
            },
            "enabled": "true",
            "excluded_file_types": []
          },
          "repository_uuid": "",
          "uncached_chunk_size": "-1b",
          "delete_searchable_snapshot": "false",
          "index_name": "",
          "partial": "false",
          "blob_cache": {
            "metadata_files": {
              "max_length": "64kb"
            }
          },
          "repository_name": "",
          "snapshot_uuid": ""
        }
      },
      "queries": {
        "cache": {
          "enabled": "true"
        }
      },
      "shard_limit": {
        "group": "normal"
      },
      "warmer": {
        "enabled": "true"
      },
      "downsample": {
        "origin": {
          "name": "",
          "uuid": ""
        },
        "source": {
          "name": "",
          "uuid": ""
        },
        "status": "unknown"
      },
      "override_write_load_forecast": "0.0",
      "max_shingle_diff": "3",
      "query_string": {
        "lenient": "false"
      }
    }
  }
}



๐ŸŒŽย API ๋ช…์„ธ

1๏ธโƒฃย [GET] BASE_URL/api/book/search?keyword={๊ฒ€์ƒ‰์–ด}

: ์œ ์ €๊ฐ€ ๊ฒ€์ƒ‰์–ด๋ฅผ ์ž…๋ ฅํ•˜๋ฉด ์Šค์ฝ”์–ด ๋‚ด๋ฆผ์ฐจ์ˆœ์œผ๋กœ ์ฑ… ๋ฆฌ์ŠคํŠธ๋ฅผ ๋ฐ˜ํ™˜ํ•œ๋‹ค.

2๏ธโƒฃย Request
  • โ˜๐ŸปRequest Header

    Content-Type: application/json
    
    
  • โœŒ๐ŸปRequest Query

    Name Type Description Required
    keyword={๊ฒ€์ƒ‰์–ด} String ๊ฒ€์ƒ‰ํ•  ์ฑ… Required
3๏ธโƒฃย Response
  • โ˜๐Ÿป์„ฑ๊ณต

    Name Type Description
    code Integer ์ƒํƒœ ์ฝ”๋“œ
    message String ์ƒํƒœ ๋ฉ”์‹œ์ง€
    data List ์ƒํƒœ ์ฝ”๋“œ
    - recommendedBookList List ai๊ฐ€ ์ถ”์ฒœํ•˜๋Š” ์ฑ…, list๋Š” ์ถ”์ฒœ์ˆœ์œผ๋กœ ์ •๋ ฌ๋จ.
    -- isbn Long ์ฑ…์˜ 13์ž๋ฆฌ isbn
    -- title String ์ฑ…์ด๋ฆ„
    -- author String ์ฑ… ์ €์ž(๋“ค)
    -- image String ์ฑ… ํ‘œ์ง€ ์ด๋ฏธ์ง€ url
    -- price Long ์ฑ…์˜ ๊ฐ€๊ฒฉ(์žฌ๊ณ ๊ฒ€์ƒ‰์„ ์œ„ํ•ด ํ•„์š”)
     {
      "code": 200,
      "message": "๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ๋ฅผ ๊ฐ€์ ธ์˜ค๋Š”๋ฐ ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค.",
      	"data": {
      		 "bookList" :[
      							{
      									"isbn" : 9791140708116,
      									"title" : "์•„๋Š” ๋งŒํผ ๋ณด์ด๋Š” ๋ฐฑ์—”๋“œ ๊ฐœ๋ฐœ (ํ•œ ๊ถŒ์œผ๋กœ ๋ณด๋Š” ๋ฐฑ์—”๋“œ ๋กœ๋“œ๋งต๊ณผ ์ปค๋ฆฌ์–ด ๊ฐ€์ด๋“œ)",
      									"author" : ["์ •์šฐํ˜„", "์ด์ธ", "๊น€๋ณด์ธ"],
      									"image" : "https://shopping-phinf.pstatic.net/main_4519670/45196700648.20240114070834.jpg",
      									"price" : 490000,
      							},
      							{
      									"isbn" : 9791140708116,
      									"title" : "์•„๋Š” ๋งŒํผ ๋ณด์ด๋Š” ๋ฐฑ์—”๋“œ ๊ฐœ๋ฐœ (ํ•œ ๊ถŒ์œผ๋กœ ๋ณด๋Š” ๋ฐฑ์—”๋“œ ๋กœ๋“œ๋งต๊ณผ ์ปค๋ฆฌ์–ด ๊ฐ€์ด๋“œ)",
      									"author" : ["์ •์šฐํ˜„", "์ด์ธ", "๊น€๋ณด์ธ"],
      									"image" : "https://shopping-phinf.pstatic.net/main_4519670/45196700648.20240114070834.jpg",
      									"price" : 490000,
      							
      							},
      							{
      									"isbn" : 9791140708116,
      									"title" : "์•„๋Š” ๋งŒํผ ๋ณด์ด๋Š” ๋ฐฑ์—”๋“œ ๊ฐœ๋ฐœ (ํ•œ ๊ถŒ์œผ๋กœ ๋ณด๋Š” ๋ฐฑ์—”๋“œ ๋กœ๋“œ๋งต๊ณผ ์ปค๋ฆฌ์–ด ๊ฐ€์ด๋“œ)",
      									"author" : ["์ •์šฐํ˜„", "์ด์ธ", "๊น€๋ณด์ธ"],
      									"image" : "https://shopping-phinf.pstatic.net/main_4519670/45196700648.20240114070834.jpg",
      									"price" : 490000,
      							},
      							
      				   ] 
      	    }
       }  
    
    
  • โœŒ๐Ÿป์‹คํŒจ

    • ํ•„์š”ํ•œ ๊ฐ’์ด ์—†๋Š” ๊ฒฝ์šฐ

      {
          "code": 400,
          "message": "keyword๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.",
          "data": null
      }
      
      
    • ์„œ๋ฒ„์—๋Ÿฌ

      {
          "code": 500,
          "message": "์„œ๋ฒ„ ์—๋Ÿฌ",
          "data": null
      }
      
      


๐Ÿ› ๏ธย ์‚ฌ์šฉ ๊ธฐ์ˆ  ์Šคํƒ

Programming language & Library

ElasticSearch

DB

Deploy & CI/CD

Version Control System

Communication Tool



About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages