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")
backend.update_role("search", update_permissions) # Adding the appropriate (lucidfind) user status = backend.create_user(username, app.config.get("FUSION_APP_PASSWORD")) if status == False: exit(1) # Creating the lucidfind collection and its request handlers if cmd_args.create_collections or create_all: # Setting shard, replica and solr param variables num_shards = app.config.get("FUSION_COLLECTION_NUM_SHARDS", "1") num_replicas = app.config.get("FUSION_COLLECTION_NUM_REPLICAS", "2") solr_params = {"replicationFactor":int(num_replicas),"numShards":int(num_shards)} # Creating the lucidfind collection status = backend.create_collection(lucidfind_collection_id, enable_signals=True, solr_params=solr_params, default_commit_within=60*10*1000) if status == False: exit(1) # Set up request handlers # DEPRECATED: Due to a bug in Solr around suggesters, let's try to remove the suggester first # backend.remove_request_handler(lucidfind_collection_id, "/suggest") # backend.remove_search_component(lucidfind_collection_id, "suggest") setup_field_types(backend, lucidfind_collection_id) setup_find_fields(backend, lucidfind_collection_id) setup_request_handlers(backend, lucidfind_collection_id) setup_commit_times(backend, lucidfind_collection_id) setup_commit_times(backend, "logs", 5*60*1000) setup_commit_times(backend, "lucidfind_logs", 5*60*1000) status = backend.create_collection("lucidfind_thread_recs") if status == False:
} ] } backend.update_role("search", update_permissions) status = backend.create_user(username, app.config.get("FUSION_APP_PASSWORD")) if status == False: exit(1) # Create the collection, setup fields and other solr pieces if cmd_args.create_collections or create_all: session = new_admin_session() # Create the "lucidfind" collection solr_params = {"replicationFactor":2,"numShards":1} status = backend.create_collection(lucidfind_collection_id, enable_signals=True, solr_params=solr_params) if status == False: exit(1) setup_field_types(backend, lucidfind_collection_id) setup_find_fields(backend, lucidfind_collection_id) setup_request_handlers(backend, lucidfind_collection_id) #create the pipelines if cmd_args.create_pipelines or create_all: setup_pipelines(backend) backend.create_query_profile(lucidfind_collection_id, "lucidfind-default", "lucidfind-default") if cmd_args.create_taxonomy or create_all: setup_taxonomy(backend, lucidfind_collection_id)
backend.update_role("search", update_permissions) status = backend.create_user(username, app.config.get("FUSION_APP_PASSWORD")) if status == False: exit(1) # Create the collection, setup fields and other solr pieces if cmd_args.create_collections or create_all: # Create the "lucidfind" collection num_shards = app.config.get("FUSION_COLLECTION_NUM_SHARDS", "1") num_replicas = app.config.get("FUSION_COLLECTION_NUM_REPLICAS", "2") solr_params = { "replicationFactor": int(num_replicas), "numShards": int(num_shards) } status = backend.create_collection(lucidfind_collection_id, enable_signals=True, solr_params=solr_params, default_commit_within=60 * 10 * 1000) if status == False: exit(1) # Due to a bug in Solr around suggesters, let's try to remove the suggester first #backend.remove_request_handler(lucidfind_collection_id, "/suggest") #backend.remove_search_component(lucidfind_collection_id, "suggest") setup_field_types(backend, lucidfind_collection_id) setup_find_fields(backend, lucidfind_collection_id) setup_request_handlers(backend, lucidfind_collection_id) setup_commit_times(backend, lucidfind_collection_id) setup_commit_times(backend, "logs", 5 * 60 * 1000) setup_commit_times(backend, "lucidfind_logs", 5 * 60 * 1000) status = backend.create_collection("lucidfind_thread_recs") if status == False: exit(1)
"path": "/signals/{0}/i".format(lucidfind_collection_id) } ] } backend.update_role("search", update_permissions) status = backend.create_user(username, app.config.get("FUSION_APP_PASSWORD")) if status == False: exit(1) # Create the collection, setup fields and other solr pieces if cmd_args.create_collections or create_all: session = new_admin_session() # Create the "lucidfind" collection status = backend.create_collection(lucidfind_collection_id, enable_signals=True) if status == False: exit(1) setup_field_types(backend, lucidfind_collection_id) setup_find_fields(backend, lucidfind_collection_id) setup_request_handlers(backend, lucidfind_collection_id) #create the pipelines if cmd_args.create_pipelines or create_all: setup_pipelines(backend) backend.create_query_profile(lucidfind_collection_id, "lucidfind-default", "lucidfind-default") if cmd_args.create_taxonomy or create_all: setup_taxonomy(backend, lucidfind_collection_id)
"methods": ["GET"], "path": "/signals/{0}/i".format(lucidfind_collection_id) }] } backend.update_role("search", update_permissions) status = backend.create_user(username, app.config.get("FUSION_APP_PASSWORD")) if status == False: exit(1) # Create the collection, setup fields and other solr pieces if cmd_args.create_collections or create_all: session = new_admin_session() # Create the "lucidfind" collection status = backend.create_collection(lucidfind_collection_id, enable_signals=True) if status == False: exit(1) setup_field_types(backend, lucidfind_collection_id) setup_find_fields(backend, lucidfind_collection_id) setup_request_handlers(backend, lucidfind_collection_id) #create the pipelines if cmd_args.create_pipelines or create_all: setup_pipelines(backend) backend.create_query_profile(lucidfind_collection_id, "lucidfind-default", "lucidfind-default") if cmd_args.create_taxonomy or create_all: setup_taxonomy(backend, lucidfind_collection_id)
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")
if status == False: exit(1) # Creating the lucidfind collection and its request handlers if cmd_args.create_collections or create_all: # Setting shard, replica and solr param variables num_shards = app.config.get("FUSION_COLLECTION_NUM_SHARDS", "1") num_replicas = app.config.get("FUSION_COLLECTION_NUM_REPLICAS", "2") solr_params = { "replicationFactor": int(num_replicas), "numShards": int(num_shards) } # Creating the lucidfind collection status = backend.create_collection(lucidfind_collection_id, enable_signals=True, solr_params=solr_params, default_commit_within=60 * 10 * 1000) if status == False: exit(1) # Set up request handlers # DEPRECATED: Due to a bug in Solr around suggesters, let's try to remove the suggester first # backend.remove_request_handler(lucidfind_collection_id, "/suggest") # backend.remove_search_component(lucidfind_collection_id, "suggest") setup_field_types(backend, lucidfind_collection_id) setup_find_fields(backend, lucidfind_collection_id) setup_request_handlers(backend, lucidfind_collection_id) setup_commit_times(backend, lucidfind_collection_id) setup_commit_times(backend, "logs", 5 * 60 * 1000) setup_commit_times(backend, "lucidfind_logs", 5 * 60 * 1000) status = backend.create_collection("lucidfind_thread_recs")
} ] } backend.update_role("search", update_permissions) status = backend.create_user(username, app.config.get("FUSION_APP_PASSWORD")) if status == False: exit(1) # Create the collection, setup fields and other solr pieces if cmd_args.create_collections or create_all: # Create the "lucidfind" collection num_shards = app.config.get("FUSION_COLLECTION_NUM_SHARDS", "1") num_replicas = app.config.get("FUSION_COLLECTION_NUM_REPLICAS", "2") solr_params = {"replicationFactor":int(num_replicas),"numShards":int(num_shards)} status = backend.create_collection(lucidfind_collection_id, enable_signals=True, solr_params=solr_params, default_commit_within=60*10*1000) if status == False: exit(1) # Due to a bug in Solr around suggesters, let's try to remove the suggester first #backend.remove_request_handler(lucidfind_collection_id, "/suggest") #backend.remove_search_component(lucidfind_collection_id, "suggest") setup_field_types(backend, lucidfind_collection_id) setup_find_fields(backend, lucidfind_collection_id) setup_request_handlers(backend, lucidfind_collection_id) setup_commit_times(backend, lucidfind_collection_id) setup_commit_times(backend, "logs", 5*60*1000) setup_commit_times(backend, "lucidfind_logs", 5*60*1000) status = backend.create_collection("lucidfind_thread_recs") if status == False: exit(1)