Ejemplo n.º 1
0
def setup_user_fields(backend, collection_id):
    backend.add_field(collection_id, "username", type="string", required=True)
    backend.add_field(collection_id, "email", type="string", required=True)
    backend.add_field(collection_id, "password", type="string", required=True)
    backend.add_field(collection_id,
                      "first_name",
                      type="string",
                      required=True)
    backend.add_field(collection_id, "last_name", type="string", required=True)
Ejemplo n.º 2
0
def setup_user_fields(backend, collection_id):
  backend.add_field(collection_id, "username", type="string", required=True)
  backend.add_field(collection_id, "email", type="string", required=True)
  backend.add_field(collection_id, "password", type="string", required=True)
  backend.add_field(collection_id, "first_name", type="string", required=True)
  backend.add_field(collection_id, "last_name", type="string", required=True)
Ejemplo n.º 3
0
def setup_find_fields(backend, collection_id):
  backend.add_field(collection_id, "publishedOnDate", type="tdate", required=True)
  backend.add_field(collection_id, "suggest", type="suggesterFT", multivalued=True)
  backend.add_field(collection_id, "all_suggest", type="suggesterFT", multivalued=True)
  backend.add_field(collection_id, "content", type="text_en")
  backend.add_field(collection_id, "project", type="string", copyDests=["suggest"])
  backend.add_field(collection_id, "project_label", type="string", copyDests=["suggest"])
  backend.add_field(collection_id, "datasource_label", type="string")
  backend.add_field(collection_id, "body", type="text_en")
  backend.add_field(collection_id, "title", type="text_en", copyDests=["suggest"])
  backend.add_field(collection_id, "keywords", type="text_en", copyDests=["suggest"])
  backend.add_field(collection_id, "comments", type="text_en")
  backend.add_field(collection_id, "mimeType", type="string")
  backend.add_field(collection_id, "author_facet", type="string", multivalued=True)
  backend.add_field(collection_id, "author", type="text_en", copyDests=["author_facet"])
  backend.add_field(collection_id, "og_description", type="text_en")
  backend.add_field(collection_id, "description", type="text_en")
  backend.add_field(collection_id, "subject", type="text_en", copyDests=["suggest"])
  backend.add_field(collection_id, "filename_exact", type="string")
  backend.add_field(collection_id, "filename", type="text_en", copyDests=["filename_exact"])
  backend.add_field(collection_id, "length", type="int")
  backend.add_field(collection_id, "isBot", type="boolean")
  backend.add_field(collection_id, "productVersion", type="float") # TODO: If we are dealing w/ an LW product, can we determine it's version?
  backend.add_field(collection_id, "productName", type="string")
  backend.add_field(collection_id, "threadId", type="string")
Ejemplo n.º 4
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")
Ejemplo n.º 5
0
    
  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")
  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")
Ejemplo n.º 6
0
def setup_find_fields(backend, collection_id):
    backend.add_field(collection_id,
                      "publishedOnDate",
                      type="tdate",
                      required=True)
    backend.add_field(collection_id,
                      "suggest",
                      type="suggesterFT",
                      multivalued=True)
    backend.add_field(collection_id,
                      "all_suggest",
                      type="suggesterFT",
                      multivalued=True)
    backend.add_field(collection_id, "content", type="text_en")
    backend.add_field(collection_id,
                      "project",
                      type="string",
                      copyDests=["suggest"])
    backend.add_field(collection_id,
                      "project_label",
                      type="string",
                      copyDests=["suggest"])
    backend.add_field(collection_id, "datasource_label", type="string")
    backend.add_field(collection_id, "body", type="text_en")
    backend.add_field(collection_id,
                      "title",
                      type="text_en",
                      copyDests=["suggest"])
    backend.add_field(collection_id,
                      "keywords",
                      type="text_en",
                      copyDests=["suggest"])
    backend.add_field(collection_id, "comments", type="text_en")
    backend.add_field(collection_id, "mimeType", type="string")
    backend.add_field(collection_id,
                      "author_facet",
                      type="string",
                      multivalued=True)
    backend.add_field(collection_id,
                      "author",
                      type="text_en",
                      copyDests=["author_facet"])
    backend.add_field(collection_id, "og_description", type="text_en")
    backend.add_field(collection_id, "description", type="text_en")
    backend.add_field(collection_id,
                      "subject",
                      type="text_en",
                      copyDests=["suggest"])
    backend.add_field(collection_id, "filename_exact", type="string")
    backend.add_field(collection_id,
                      "filename",
                      type="text_en",
                      copyDests=["filename_exact"])
    backend.add_field(collection_id, "length", type="int")
    backend.add_field(collection_id, "isBot", type="boolean")
    backend.add_field(
        collection_id, "productVersion", type="float"
    )  # If we are dealing w/ an LW product, can we determine it's version?
    backend.add_field(collection_id, "productName", type="string")
    backend.add_field(collection_id, "threadId", type="string")
Ejemplo n.º 7
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")
Ejemplo n.º 8
0
        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",