indexing

Sitecore Refresh Index

瘦欲@ 提交于 2020-01-04 02:39:08
问题 I am working on Sitecore 7.2 and using Lucene search, I have created few templates and pages and search is working fine, now I want to exclude few templates from the index, I have a custom crawler and that does remove the templates from indexes but index is not refreshed, I am using following code to update index foreach (Cache cache in CacheManager.GetAllCaches()) { //WriteLog(string.Concat(" Clearing Cache, name = ", cache.Name)); cache.Clear(); } //WriteLog("Clearing caching finished");

Index error, delete row from array if column has a value

最后都变了- 提交于 2020-01-04 02:22:33
问题 I have a array 'x' with four columns. For each row if the 4th column has a value of 1 then I want to delete that entire row: x = np.array([[1,2,3,0],[11,2,3,24],[1,22,3,1],[1,22,3,1], [5,6,7,8], [9,10,11,1]]) for i in range(0,len(x)): if x[i][4]==0: x=np.delete(x, i,0) I get the following error: Traceback (most recent call last): File "", line 2, in if x[i][4]==0: IndexError: index out of bounds 回答1: You can use indexing: >>> x[x[:,3] != 1] array([[ 1, 2, 3, 0], [11, 2, 3, 24], [ 5, 6, 7, 8]]

Assignment / modification of values in an indexed subframe in Pandas

拟墨画扇 提交于 2020-01-04 01:56:49
问题 The documentation for indexing has few examples of assignment of a non-scalar right hand side. In this case, I want to modify a subset of my dataframe, and what I did prior to v.13 no longer works. import pandas as pd from numpy import * data = {'me':list('rttti'),'foo': list('aaade'), 'bar': arange(5)*1.34+2, 'bar2': arange(5)*-.34+2} df = pd.DataFrame(data).set_index('me') print df df.loc['r',['bar','bar2']]*=2.0 print df df.loc['t','bar']*=2.5 # Above fails: ValueError: Must have equal len

Expected Behaviour of Compound _id in MongoDB?

╄→гoц情女王★ 提交于 2020-01-03 20:09:11
问题 I have a compound _id containing 3 numeric properties: _id": { "KeyA": 0, "KeyB": 0, "KeyC": 0 } The database in question has 2 million identical values for KeyA and clusters of 500k identical values for KeyB. My understanding is that I can efficiently query for KeyA and KeyB using the command: find( { "_id.KeyA" : 1, "_id.KeyB": 3 } ).limit(100) When I explain this query the result is: "cursor" : "BasicCursor", "nscanned" : 1000100, "nscannedObjects" : 1000100, "n" : 100, "millis" : 1592,

How to convert the data structure obtained after performing a groupby operation on a pandas dataframe into a dataframe?

强颜欢笑 提交于 2020-01-03 19:37:13
问题 Say I have the dataset from the example here: import pandas as pd raw_data = {'regiment': ['Nighthawks', 'Nighthawks', 'Nighthawks', 'Nighthawks', 'Dragoons', 'Dragoons', 'Dragoons', 'Dragoons', 'Scouts', 'Scouts', 'Scouts', 'Scouts'], 'company': ['1st', '1st', '2nd', '2nd', '1st', '1st', '2nd', '2nd','1st', '1st', '2nd', '2nd'], 'name': ['Miller', 'Jacobson', 'Ali', 'Milner', 'Cooze', 'Jacon', 'Ryaner', 'Sone', 'Sloan', 'Piger', 'Riani', 'Ali'], 'preTestScore': [4, 24, 31, 2, 3, 4, 24, 31, 2

Why does MySQL not use an index on a int field that's being used as a boolean?

拟墨画扇 提交于 2020-01-03 18:58:13
问题 select * from myTable where myInt will not show any possible_keys when explaining the query even though there is an index on myInt field. Edit: The index in question is not unique. 回答1: For MySQL to use the index, you have to explicitly compare the int field to a value (e.g. true, 1). select * from myTable where myInt = true 回答2: I'm not a database expert, but doesn't it defeat the purpose of having an index on the field if there is only two possible values of the field? If all of the fields

Why does MySQL not use an index on a int field that's being used as a boolean?

浪子不回头ぞ 提交于 2020-01-03 18:58:13
问题 select * from myTable where myInt will not show any possible_keys when explaining the query even though there is an index on myInt field. Edit: The index in question is not unique. 回答1: For MySQL to use the index, you have to explicitly compare the int field to a value (e.g. true, 1). select * from myTable where myInt = true 回答2: I'm not a database expert, but doesn't it defeat the purpose of having an index on the field if there is only two possible values of the field? If all of the fields

Display mongodb index contents

♀尐吖头ヾ 提交于 2020-01-03 18:55:29
问题 After building an index, I'd like to view the contents of the index. Taking an example for illustration from the MonboDB docs: { "_id" : ObjectId("..."), "name" : "Warm Weather", "author" : "Steve", "tags" : [ "weather", "hot", "record", "april" ] } Then an index on the tags field would have these values: { tags: "weather" } { tags: "hot" } { tags: "record" } { tags: "april" } So, I want to run a command, say, db.weather._tags_.find() to display said values. Question: Does such a shell

mongodb: How to use an index for distinct command and query?

扶醉桌前 提交于 2020-01-03 17:26:11
问题 I have some problems with very slow distinct commands that use a query. From what I have observed the distinct command only makes use of an index if you do not specify a query : I have created a test database on my MongoDB 3.0.10 server with 1Mio objects. Each object looks as follows: { "_id" : ObjectId("56e7fb5303858265f53c0ea1"), "field1" : "field1_6", "field2" : "field2_10", "field3" : "field3_29", "field4" : "field4_64" } The numbers at the end of the field values are random 0-99. On the

Why is SQL Server not using Index for very similar datetime query?

萝らか妹 提交于 2020-01-03 17:06:47
问题 i have a table on SQL Server with about 1 million rows. It has an ID (PK), a status (int) and a datetime column. Also I've created an Index on the datetime column. Now I've found out an effect, which I don't understand. SELECT status FROM table WHERE dateTime BETWEEN '2010-01-01T00:00:00' AND '2010-01-02T12:00:00' This statement returns 3664 rows. It runs about 150ms and the execution plan shows that its doing an index seek with key lookup. Now, if I change it as following (just change the