mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
add default config for TS search; rename to match TS playbook
This commit is contained in:
@@ -46,6 +46,14 @@ session_data_dir = %(here)s/database/beaker_sessions
|
||||
session_key = galaxysessions
|
||||
session_secret = changethisinproduction
|
||||
|
||||
# -- Repository and Tool search
|
||||
# Using the script located at scripts/build_ts_whoosh_index.py
|
||||
# you can generate search index and allow full text API searching over
|
||||
# the repositories and tools within the Tool Shed given that you specify
|
||||
# the following two config options.
|
||||
toolshed_search_on = True
|
||||
whoosh_index_dir = database/toolshed_whoosh_indexes
|
||||
|
||||
# -- Analytics
|
||||
|
||||
# You can enter tracking code here to track visitor's behavior
|
||||
|
||||
@@ -43,8 +43,8 @@ class Configuration( object ):
|
||||
self.database_engine_options = get_database_engine_options( kwargs )
|
||||
self.database_create_tables = string_as_bool( kwargs.get( "database_create_tables", "True" ) )
|
||||
# Whoosh search
|
||||
self.toolshed_search_on = string_as_bool( kwargs.get( "toolshed_search_on", False ) )
|
||||
self.toolshed_whoosh_index_dir = kwargs.get( "toolshed_whoosh_index_dir", None )
|
||||
self.toolshed_search_on = string_as_bool( kwargs.get( "toolshed_search_on", True ) )
|
||||
self.whoosh_index_dir = kwargs.get( "whoosh_index_dir", 'database/toolshed_whoosh_indexes' )
|
||||
# Analytics
|
||||
self.ga_code = kwargs.get( "ga_code", None )
|
||||
self.session_duration = int(kwargs.get( 'session_duration', 0 ))
|
||||
|
||||
@@ -6,7 +6,9 @@ $ python scripts/tool_shed/build_ts_whoosh_index_test.py -c config/tool_shed.ini
|
||||
|
||||
Make sure you adjusted your config to:
|
||||
* turn on searching via toolshed_search_on
|
||||
* specify toolshed_whoosh_index_dir where the indexes will be placed
|
||||
* specify whoosh_index_dir where the indexes will be placed
|
||||
|
||||
Also make sure that GALAXY_EGGS_PATH variable is properly set.
|
||||
"""
|
||||
import sys
|
||||
import os
|
||||
@@ -53,15 +55,18 @@ tool_schema = Schema(
|
||||
repo_id=STORED )
|
||||
|
||||
|
||||
def build_index( sa_session, toolshed_whoosh_index_dir, path_to_repositories ):
|
||||
def build_index( sa_session, whoosh_index_dir, path_to_repositories ):
|
||||
"""
|
||||
Build the search indexes. One for repositories and another for tools within.
|
||||
"""
|
||||
repo_index_storage = FileStorage( toolshed_whoosh_index_dir )
|
||||
tool_index_dir = os.path.join( toolshed_whoosh_index_dir, 'tools' )
|
||||
# Rare race condition exists here
|
||||
# Rare race condition exists here and below
|
||||
if not os.path.exists( whoosh_index_dir ):
|
||||
os.makedirs( whoosh_index_dir )
|
||||
tool_index_dir = os.path.join( whoosh_index_dir, 'tools' )
|
||||
if not os.path.exists( tool_index_dir ):
|
||||
os.makedirs( tool_index_dir )
|
||||
|
||||
repo_index_storage = FileStorage( whoosh_index_dir )
|
||||
tool_index_storage = FileStorage( tool_index_dir )
|
||||
|
||||
repo_index = repo_index_storage.create_index( repo_schema )
|
||||
@@ -205,5 +210,5 @@ if __name__ == "__main__":
|
||||
path_to_tool_shed_config = options.path_to_tool_shed_config
|
||||
path_to_repositories = options.path_to_repositories
|
||||
sa_session, config_settings = get_sa_session_and_needed_config_settings( path_to_tool_shed_config )
|
||||
toolshed_whoosh_index_dir = config_settings.get( 'toolshed_whoosh_index_dir', None )
|
||||
build_index( sa_session, toolshed_whoosh_index_dir, path_to_repositories )
|
||||
whoosh_index_dir = config_settings.get( 'whoosh_index_dir', None )
|
||||
build_index( sa_session, whoosh_index_dir, path_to_repositories )
|
||||
|
||||
Reference in New Issue
Block a user