indexing

Mongodb 2dsphere index for nested array field

二次信任 提交于 2020-01-02 15:37:28
问题 I have created collection and a object is looks like this. [_id] => MongoId Object ( [$id] => 53087f483b15eaeb6c3c9869 ) [time_from] => 2014-02-22 00:00:00 [time_to] => 2014-02-22 00:10:00 [checkin] => Array ( [0] => Array ( [time_frame] => 2014-02-22 00:00:56 [user_id] => 1 [loc] => Array ( [type] => Point [coordinates] => Array ( [0] => 73.43 [1] => 42.22 ) ) ) [1] => Array ( [time_frame] => 2014-02-22 00:00:56 [user_id] => 2 [loc] => Array ( [type] => Point [coordinates] => Array ( [0] =>

Indexing on a field and “order by” on another field

六月ゝ 毕业季﹏ 提交于 2020-01-02 15:08:16
问题 Let's assume I have a small database with three columns : "id1", "id2" and "date". I am indexing my database on the field "id1" since it is a frequently selected field (many select queries are ran with ex: where "id1" = 125548). In some particular query I have, I need to sort the records of a user based on the date" field in the table which is not indexed. My curiosity is if the sort operation (which is basically a order-by operation) on the date field will be ran on the whole database or

how to solve - “too many text index for ..” - mongodb error?

前提是你 提交于 2020-01-02 14:33:16
问题 Getting this error and don't know why, here is the snippet of the function that deals with mongodb full-text search: ... db.collection.ensureIndex({ description: 'text' }, { name: 'TextIndex' }); db.collection.runCommand('text', { search: 'my query' }, function (err, res) { console.log(res); // { // "message": "failed to search items for user by query", // "error": "too many text index for: .. // } }); The same problem appears in mongo shell as well.. 来源: https://stackoverflow.com/questions

how to solve - “too many text index for ..” - mongodb error?

回眸只為那壹抹淺笑 提交于 2020-01-02 14:32:17
问题 Getting this error and don't know why, here is the snippet of the function that deals with mongodb full-text search: ... db.collection.ensureIndex({ description: 'text' }, { name: 'TextIndex' }); db.collection.runCommand('text', { search: 'my query' }, function (err, res) { console.log(res); // { // "message": "failed to search items for user by query", // "error": "too many text index for: .. // } }); The same problem appears in mongo shell as well.. 来源: https://stackoverflow.com/questions

Merge two list contained dictionary based on its index in python

孤街浪徒 提交于 2020-01-02 12:02:09
问题 I have two list contain multi dictionary, each dictionary has a list as value, these are my list: list1 = [{'a':[12,22,61],'b':[21,12,50]},{'c':[10,11,47],'d':[13,20,45],'e':[11,24,42]},{'a':[12,22,61],'b':[21,12,50]}] list2 = [{'f':[21,23,51],'g':[11,12,44]},{'h':[22,26,68],'i':[12,9,65],'j':[10,12,50]},{'f':[21,23,51],'g':[11,12,44]}] In my case, i need to merge these list with this rule: Dictionary from the first list (list1) only can be merged by dictionary from the second list (list2)

Efficient PostgreSQL query on timestamp using index or bitmap index scan?

自作多情 提交于 2020-01-02 09:13:33
问题 In PostgreSQL, I have an index on a date field on my tickets table. When I compare the field against now() , the query is pretty efficient: # explain analyze select count(1) as count from tickets where updated_at > now(); QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=90.64..90.66 rows=1 width=0) (actual time=33.238..33.238 rows=1 loops=1) -> Index Scan using tickets

Solr index and search multilingual data

a 夏天 提交于 2020-01-02 09:09:29
问题 In my Solr schema during indexing Solr detects a language of the data being indexed and applies different indexing rules according to the language it's detected. All data is stored in language specific fields, for example: English titles are stored in title_en field. Spanish titles are stored in title_es field. - <field name="title_en" type="text_en" indexed="true" stored="true"/> <field name="title_es" type="text_es" indexed="true" stored="true"/> All searches are made against one catch-all

Grabbing specific indices of a list [duplicate]

本小妞迷上赌 提交于 2020-01-02 08:03:56
问题 This question already has answers here : Explicitly select items from a list or tuple (8 answers) Closed 6 years ago . Is there a way to grab specific indices of a list, much like what I can do in NumPy? sample = ['a','b','c','d','e','f'] print sample[0,3,5] >>>['a','d','f'] I've tried Googling this, but I couldn't find a good way to word my issue that resulted in relevant results... 回答1: You can use a list comprehension: >>> sample = ['a','b','c','d','e','f'] >>> [sample[i] for i in (0, 3, 5

Should Lookup Table Foreign Keys Always be Indexed?

狂风中的少年 提交于 2020-01-02 08:03:51
问题 If I have a lookup table with very few records in it (say, less than ten), should I bother putting an index on the Foreign Key of another table to which it is attached? For that matter, does the lookup table even need an index on the Primary Key? Specifically, is there any performance benefit that outweighs the overhead of maintaining the indexes? If not, are there any benefits other than speed? Note: an example of a lookup table might be Order Status, where the tuples are: 1 - Order Received

Should Lookup Table Foreign Keys Always be Indexed?

一笑奈何 提交于 2020-01-02 08:02:24
问题 If I have a lookup table with very few records in it (say, less than ten), should I bother putting an index on the Foreign Key of another table to which it is attached? For that matter, does the lookup table even need an index on the Primary Key? Specifically, is there any performance benefit that outweighs the overhead of maintaining the indexes? If not, are there any benefits other than speed? Note: an example of a lookup table might be Order Status, where the tuples are: 1 - Order Received