当前位置: 首页>>代码示例>>Python>>正文


Python pymongo.TEXT属性代码示例

本文整理汇总了Python中pymongo.TEXT属性的典型用法代码示例。如果您正苦于以下问题:Python pymongo.TEXT属性的具体用法?Python pymongo.TEXT怎么用?Python pymongo.TEXT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在pymongo的用法示例。


在下文中一共展示了pymongo.TEXT属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: connect

# 需要导入模块: import pymongo [as 别名]
# 或者: from pymongo import TEXT [as 别名]
def connect(self):
        self.init()

        # Create indexes
        self.files.create_index('md5')
        self.files.create_index('sha1')
        self.files.create_index('sha256')
        self.files.create_index([("$**", TEXT)], background=True)
        self.analysis.create_index('date')
        self.analysis.create_index([("$**", TEXT)], background=True) 
开发者ID:certsocietegenerale,项目名称:fame,代码行数:12,代码来源:store.py

示例2: __init__

# 需要导入模块: import pymongo [as 别名]
# 或者: from pymongo import TEXT [as 别名]
def __init__(self, function_result_status_persistance_conf, queue_name):
        self.function_result_status_persistance_conf = function_result_status_persistance_conf
        if self.function_result_status_persistance_conf.is_save_status:
            task_status_col = self.mongo_db_task_status.get_collection(queue_name)
            # params_str 如果很长,必须使用TEXt或HASHED索引。
            task_status_col.create_indexes([IndexModel([("insert_time_str", -1)]), IndexModel([("insert_time", -1)]),
                                            IndexModel([("params_str", pymongo.TEXT)]), IndexModel([("success", 1)])
                                            ], )
            task_status_col.create_index([("utime", 1)],
                                         expireAfterSeconds=function_result_status_persistance_conf.expire_seconds)  # 只保留7天。
            self._mongo_bulk_write_helper = MongoBulkWriteHelper(task_status_col, 100, 2)
            self.task_status_col = task_status_col 
开发者ID:ydf0509,项目名称:distributed_framework,代码行数:14,代码来源:base_consumer.py

示例3: init

# 需要导入模块: import pymongo [as 别名]
# 或者: from pymongo import TEXT [as 别名]
def init(dataset_name, create_index=True):
    # Connection to DB system
    global dbc
    dbc = MongoClient(C.db_location)
    # Configure right DB
    global database
    database = dbc[dataset_name]
    global modeldb
    modeldb = database.columns
    # Create full text search index
    if create_index:
        print("Creating full-text search index")
        modeldb.create_index([('t_data', TEXT)])
        modeldb.create_index([("key", HASHED)]) 
开发者ID:mitdbg,项目名称:aurum-datadiscovery,代码行数:16,代码来源:mongomodelstore.py

示例4: create_text_index

# 需要导入模块: import pymongo [as 别名]
# 或者: from pymongo import TEXT [as 别名]
def create_text_index(collection, field_name, *args):
        # type: (pymongo.collection.Collection, str, SortOrder, bool) -> ()
        MongoRepository.create_index(collection, field_name, pymongo.TEXT) 
开发者ID:accelero-cloud,项目名称:appkernel,代码行数:5,代码来源:repository.py

示例5: explicit_key

# 需要导入模块: import pymongo [as 别名]
# 或者: from pymongo import TEXT [as 别名]
def explicit_key(index):
    if isinstance(index, (list, tuple)):
        assert len(index) == 2, 'Must be a (`key`, `direction`) tuple'
        return index
    if index.startswith('+'):
        return (index[1:], ASCENDING)
    if index.startswith('-'):
        return (index[1:], DESCENDING)
    if index.startswith('$'):
        return (index[1:], TEXT)
    if index.startswith('#'):
        return (index[1:], HASHED)
    return (index, ASCENDING) 
开发者ID:Scille,项目名称:umongo,代码行数:15,代码来源:indexes.py

示例6: __init__

# 需要导入模块: import pymongo [as 别名]
# 或者: from pymongo import TEXT [as 别名]
def __init__(self, config):
        #*** Required for BaseClass:
        self.config = config
        #*** Set up Logging with inherited base class method:
        self.configure_logging(__name__, "switches_logging_level_s",
                                       "switches_logging_level_c")

        #*** Set up database collections:
        #*** Get parameters from config:
        mongo_addr = config.get_value("mongo_addr")
        mongo_port = config.get_value("mongo_port")
        mongo_dbname = config.get_value("mongo_dbname")

        #*** Start mongodb:
        self.logger.info("Connecting to MongoDB database...")
        mongo_client = MongoClient(mongo_addr, mongo_port)

        #*** Connect to MongoDB nmeta database:
        db_nmeta = mongo_client[mongo_dbname]

        #*** Delete (drop) previous switches collection if it exists:
        self.logger.debug("Deleting previous switches MongoDB collection...")
        db_nmeta.switches_col.drop()

        #*** Create the switches collection:
        self.switches_col = db_nmeta.create_collection('switches_col')

        #*** Index dpid key to improve look-up performance:
        self.switches_col.create_index([('dpid', pymongo.TEXT)], unique=False)

        #*** Get max bytes of new flow packets to send to controller from
        #*** config file:
        self.miss_send_len = config.get_value("miss_send_len")
        if self.miss_send_len < 1500:
            self.logger.info("Be aware that setting "
                             "miss_send_len to less than a full size packet "
                             "may result in errors due to truncation. "
                             "Configured value is %s bytes",
                             self.miss_send_len)
        #*** Tell switch how to handle fragments (see OpenFlow spec):
        self.ofpc_frag = config.get_value("ofpc_frag")

        #*** Flow mod cookie value offset indicates flow session direction:
        self.offset = config.get_value("flow_mod_cookie_reverse_offset")

        #*** Dictionary of the instances of the Switch class,
        #***  key is the switch DPID which is assumed to be unique:
        self.switches = {} 
开发者ID:mattjhayes,项目名称:nmeta,代码行数:50,代码来源:switches.py


注:本文中的pymongo.TEXT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。