예제 #1
0
def setup_pipelines(backend):
  pipe_files = [f for f in listdir("./fusion_config/pipeline_configs") if isfile(join("./fusion_config/pipeline_configs", f)) and f.endswith("_pipeline.json")]
  for file in pipe_files:
    print ("Creating Pipeline for %s" % file)
    if file.find("query") != -1:
      backend.create_pipeline(json.load(open(join("./fusion_config/pipeline_configs", file))), pipe_type="query-pipelines")
    else:
      backend.create_pipeline(json.load(open(join("./fusion_config/pipeline_configs", file))))
예제 #2
0
def setup_pipelines(backend):
    pipe_files = [
        f for f in listdir("./fusion_config")
        if isfile(join("./fusion_config", f)) and f.endswith("_pipeline.json")
    ]
    for file in pipe_files:
        print("Creating Pipeline for %s" % file)
        if file.find("query") != -1:
            backend.create_pipeline(json.load(
                open(join("./fusion_config", file))),
                                    pipe_type="query-pipelines")
        else:
            backend.create_pipeline(
                json.load(open(join("./fusion_config", file))))
예제 #3
0
def setup_typeahead_collection(backend):
  print ("Creating typeahead collection ")
  collection_id = "shub-typeahead"
  status = backend.create_collection("shub-typeahead", enable_signals=False, enable_search_logs=False, enable_dynamic_schema=False)
  if status == False:
    exit(1)
    
  files = [f for f in listdir("./typeahead_config") if isfile(join("./typeahead_config", f)) and f.endswith("_field_type.json")]
  for file in files:
    print ("Creating typeahead field_type for %s" % file)
    backend.add_field_type("shub-typeahead", json.load(open(join("./typeahead_config", file))))

  pipe_files = [f for f in listdir("./typeahead_config") if isfile(join("./typeahead_config", f)) and f.endswith("_pipeline.json")]
  for file in pipe_files:
    print ("Creating Pipeline for %s" % file)
    if file.find("query") != -1:
      backend.create_pipeline(json.load(open(join("./typeahead_config", file))), pipe_type="query-pipelines")
    else:
      backend.create_pipeline(json.load(open(join("./typeahead_config", file))))

  backend.add_field(collection_id, "name_contains", type="ngram", stored="true", multivalued="false")
  backend.add_field(collection_id, "name_edge", type="edge_ngram", stored="true", multivalued="false")
  backend.add_field(collection_id, "name_en", type="text_en", stored="true", multivalued="false")
  backend.add_field(collection_id, "name_no_vowels", type="text_no_vowels", stored="true", multivalued="false")
  backend.add_field(collection_id, "name_phonetic_en", type="phonetic_en", stored="true", multivalued="false")
  backend.add_field(collection_id, "name_sort", type="string_sort", stored="false", multivalued="false")
  backend.add_field(collection_id, "spell", type="text_general", stored="false", multivalued="false")
  
  backend.add_field(collection_id, "name", type="text_general", multivalued="false", stored="true", copyDests=["name_edge", "name_contains", "name_no_vowels", "name_phonetic_en", "name_en", "name_sort", "spell"])
  backend.add_field(collection_id, "type", type="string", stored="true")
  backend.add_field(collection_id, "synonyms", type="text_general", stored="true", multivalued="true")
  backend.add_field(collection_id, "bh_search_score", type="int", stored="true")
  backend.add_field(collection_id, "bh_rank", type="int", stored="true")
  backend.add_field(collection_id, "productVersion", type="string", stored="true")
  backend.add_field(collection_id, "resourceName", type="string", multivalued="true")
  print ("Finished creating fields")
예제 #4
0
if cmd_args.create_typeahead_collection:
  collection_id = "shub-typeahead"
  status = backend.create_collection("shub-typeahead", enable_signals=False, enable_search_logs=False, enable_dynamic_schema=False)
  if status == False:
    exit(1)
    
  files = [f for f in listdir("./typeahead_config") if isfile(join("./typeahead_config", f)) and f.endswith("_field_type.json")]
  for file in files:
    print ("Creating typeahead field_type for %s" % file)
    backend.add_field_type("shub-typeahead", json.load(open(join("./typeahead_config", file))))

  pipe_files = [f for f in listdir("./typeahead_config") if isfile(join("./typeahead_config", f)) and f.endswith("_pipeline.json")]
  for file in pipe_files:
    print ("Creating Pipeline for %s" % file)
    if file.find("query") != -1:
      backend.create_pipeline(json.load(open(join("./typeahead_config", file))), pipe_type="query-pipelines")
    else:
      backend.create_pipeline(json.load(open(join("./typeahead_config", file))))
      
  print ("Creating fields")
  backend.add_field(collection_id, "name_contains", type="ngram", stored="true", multivalued="false")
  backend.add_field(collection_id, "name_edge", type="edge_ngram", stored="true", multivalued="false")
  backend.add_field(collection_id, "name_en", type="text_en", stored="true", multivalued="false")
  backend.add_field(collection_id, "name_no_vowels", type="text_no_vowels", stored="true", multivalued="false")
  backend.add_field(collection_id, "name_phonetic_en", type="phonetic_en", stored="true", multivalued="false")
  backend.add_field(collection_id, "name_sort", type="string_sort", stored="false", multivalued="false")
  backend.add_field(collection_id, "spell", type="text_general", stored="false", multivalued="false")
  
  backend.add_field(collection_id, "name", type="text_general", multivalued="false", stored="true", copyDests=["name_edge", "name_contains", "name_no_vowels", "name_phonetic_en", "name_en", "name_sort", "spell"])
  backend.add_field(collection_id, "type", type="string", stored="true")
  backend.add_field(collection_id, "synonyms", type="text_general", stored="true", multivalued="true")
예제 #5
0
def setup_typeahead_collection(backend):
    print("Creating typeahead collection ")
    collection_id = "shub-typeahead"
    status = backend.create_collection("shub-typeahead",
                                       enable_signals=False,
                                       enable_search_logs=False,
                                       enable_dynamic_schema=False)
    if status == False:
        exit(1)

    files = [
        f for f in listdir("./typeahead_config")
        if isfile(join("./typeahead_config", f))
        and f.endswith("_field_type.json")
    ]
    for file in files:
        print("Creating typeahead field_type for %s" % file)
        backend.add_field_type(
            "shub-typeahead", json.load(open(join("./typeahead_config",
                                                  file))))

    pipe_files = [
        f for f in listdir("./typeahead_config") if
        isfile(join("./typeahead_config", f)) and f.endswith("_pipeline.json")
    ]
    for file in pipe_files:
        print("Creating Pipeline for %s" % file)
        if file.find("query") != -1:
            backend.create_pipeline(json.load(
                open(join("./typeahead_config", file))),
                                    pipe_type="query-pipelines")
        else:
            backend.create_pipeline(
                json.load(open(join("./typeahead_config", file))))

    backend.add_field(collection_id,
                      "name_contains",
                      type="ngram",
                      stored="true",
                      multivalued="false")
    backend.add_field(collection_id,
                      "name_edge",
                      type="edge_ngram",
                      stored="true",
                      multivalued="false")
    backend.add_field(collection_id,
                      "name_en",
                      type="text_en",
                      stored="true",
                      multivalued="false")
    backend.add_field(collection_id,
                      "name_no_vowels",
                      type="text_no_vowels",
                      stored="true",
                      multivalued="false")
    backend.add_field(collection_id,
                      "name_phonetic_en",
                      type="phonetic_en",
                      stored="true",
                      multivalued="false")
    backend.add_field(collection_id,
                      "name_sort",
                      type="string_sort",
                      stored="false",
                      multivalued="false")
    backend.add_field(collection_id,
                      "spell",
                      type="text_general",
                      stored="false",
                      multivalued="false")

    backend.add_field(collection_id,
                      "name",
                      type="text_general",
                      multivalued="false",
                      stored="true",
                      copyDests=[
                          "name_edge", "name_contains", "name_no_vowels",
                          "name_phonetic_en", "name_en", "name_sort", "spell"
                      ])
    backend.add_field(collection_id, "type", type="string", stored="true")
    backend.add_field(collection_id,
                      "synonyms",
                      type="text_general",
                      stored="true",
                      multivalued="true")
    backend.add_field(collection_id,
                      "bh_search_score",
                      type="int",
                      stored="true")
    backend.add_field(collection_id, "bh_rank", type="int", stored="true")
    backend.add_field(collection_id,
                      "productVersion",
                      type="string",
                      stored="true")
    backend.add_field(collection_id,
                      "resourceName",
                      type="string",
                      multivalued="true")
    print("Finished creating fields")
예제 #6
0
    ]
    for file in files:
        print("Creating typeahead field_type for %s" % file)
        backend.add_field_type(
            "shub-typeahead", json.load(open(join("./typeahead_config",
                                                  file))))

    pipe_files = [
        f for f in listdir("./typeahead_config") if
        isfile(join("./typeahead_config", f)) and f.endswith("_pipeline.json")
    ]
    for file in pipe_files:
        print("Creating Pipeline for %s" % file)
        if file.find("query") != -1:
            backend.create_pipeline(json.load(
                open(join("./typeahead_config", file))),
                                    pipe_type="query-pipelines")
        else:
            backend.create_pipeline(
                json.load(open(join("./typeahead_config", file))))

    print("Creating fields")
    backend.add_field(collection_id,
                      "name_contains",
                      type="ngram",
                      stored="true",
                      multivalued="false")
    backend.add_field(collection_id,
                      "name_edge",
                      type="edge_ngram",
                      stored="true",