indexing

Couchdb, Mango queries and Indexes

≡放荡痞女 提交于 2019-12-30 07:14:14
问题 I use Mango queries with Couchdb when users want to search the database. They can search by multiple fields in the document. To simplify I have a document with three fields all of which can be searched to find the document. FieldOne: cow FieldTwo: pig FieldThree: dog When creating a mango index for the query what fields should I use? Should I create and index with multiple fields? Does the order matter? There are also three different document types (A, B C) defined in a field. I only need to

Indexing Attachment file to elastic search

时光总嘲笑我的痴心妄想 提交于 2019-12-30 07:07:05
问题 I have typed this command to index a document in Elasticsearch create an index curl -X PUT "localhost:9200/test_idx_1x" create a mapping curl -X PUT "localhost:9200/test_idx_1x/test_mapping_1x/_mapping" -d '{ "test_mapping_1x": { "properties": { "my_attachments": { "type": "attachment" } } } }' index this document curl -XPUT 'http://localhost:9200/test_idx_1x/test_mapping_1x/4' -d '{ "post_date": "2009-11-15T14:12:12", "message": "test Elastic Search", "name": "N1" }' All these three commands

@CompoundIndex not working in Spring Data MongoDB

自闭症网瘾萝莉.ら 提交于 2019-12-30 06:26:22
问题 I am working on an application using Spring Data MongoDB. I would like to create a compound index on one of my models. I have added a @CompoundIndex annotation at the top like so: @Document @CompoundIndexes({ @CompoundIndex(name = "name_", def = "{ 'tenantId': 1, 'name': 1 }", unique = true) }) public class MyModel { } However, the index is not created. I have also tried to directly place the @CompoundIndex above the class. The collection is still missing the index. The same index definition

@CompoundIndex not working in Spring Data MongoDB

試著忘記壹切 提交于 2019-12-30 06:26:11
问题 I am working on an application using Spring Data MongoDB. I would like to create a compound index on one of my models. I have added a @CompoundIndex annotation at the top like so: @Document @CompoundIndexes({ @CompoundIndex(name = "name_", def = "{ 'tenantId': 1, 'name': 1 }", unique = true) }) public class MyModel { } However, the index is not created. I have also tried to directly place the @CompoundIndex above the class. The collection is still missing the index. The same index definition

Indexing SQL for Between query with only one match?

拥有回忆 提交于 2019-12-30 06:00:56
问题 We have a table with more than two million rows where all queries against it will be a Between lookup using Column1 and Column2 . Also, there will only be one possible result. For example... Col1 Col2 1 5 6 10 11 15 select * from table1 where 8 between Col1 and Col2 I currently have an unique clustered index on Col1 and Col2 . So far I have been unable to figure out how to further tune the query and the indexes to minimize the rows handled. The execution plan currently reports cost of almost

Is there a way to merge multiple list index by index?

孤街醉人 提交于 2019-12-30 05:24:07
问题 For example, I have three lists (of the same length) A = [1,2,3] B = [a,b,c] C = [x,y,z] and i want to merge it into something like: [[1,a,x],[2,b,y],[3,c,z]]. Here is what I have so far: define merger(A,B,C): answer = for y in range (len(A)): a = A[y] b = B[y] c = C[y] temp = [a,b,c] answer = answer.extend(temp) return answer Received error: 'NoneType' object has no attribute 'extend' 回答1: It looks like your code is meant to say answer = [] , and leaving that out will cause problems. But the

SQL Server - how to determine if indexes aren't being used?

放肆的年华 提交于 2019-12-30 04:41:26
问题 I have a high-demand transactional database that I think is over-indexed. Originally, it didn't have any indexes at all, so adding some for common processes made a huge difference. However, over time, we've created indexes to speed up individual queries, and some of the most popular tables have 10-15 different indexes on them, and in some cases, the indexes are only slightly different from each other, or are the same columns in a different order. Is there a straightforward way to watch

Using numpy.argmax() on multidimensional arrays

雨燕双飞 提交于 2019-12-30 04:00:05
问题 I have a 4 dimensional array, i.e., data.shape = (20,30,33,288) . I am finding the index of the closest array to n using index = abs(data - n).argmin(axis = 1), so index.shape = (20,33,288) with the indices varying. I would like to use data[index] = "values" with values.shape = (20,33,288) , but data[index] returns the error "index (8) out of range (0<=index<1) in dimension 0" or this operation takes a relatively long time to compute and returns a matrix with a shape that doesn't seem to make

Correct indexing when using OR operator

[亡魂溺海] 提交于 2019-12-30 03:17:08
问题 I have a query like this: SELECT fields FROM table WHERE field1='something' OR field2='something' OR field3='something' OR field4='something' What would be the correct way to index such a table for this query? A query like this takes a entire second to run! I have 1 index with all 4 of those fields in it, so I'd think mysql would do something like this: Go through each row in the index thinking this: Is field1 something? How about field2? field3? field4? Ok, nope, go to the next row. 回答1: You

Lucene.Net writing/reading synchronization

巧了我就是萌 提交于 2019-12-30 03:09:09
问题 Could I write (with IndexWriter ) new documents into index while it is opened for reading (with IndexReader )? Or must I close reading before writing? Could I read/search documents (with IndexReader ) in index while it is opened for writing (with IndexWriter )? Or must I close writing before reading? Is Lucene.Net thread safely or not? Or must I write my own? 回答1: You may have any amount of readers/searchers opened at any time, but only one writer. This is enforced by a directory specific