If you get this in mongo console
db.coll.ensureIndex({'content':'text'})
{
"err" : "text search not enabled",
"code" : 16633,
"n" : 0,
"connectionId" : 1,
"ok" : 1
}
, and this in mongod console
[conn1] insert test.system.indexes keyUpdates:0 exception: text search not enabled code:16633 locks(micros) w:336411 336ms
, you need to enable full text search when starting MongoDB.
mongod --setParameter textSearchEnabled=true
Try again.
db.coll.ensureIndex({'content':'text'})
What's happening in background?
[initandlisten] connection accepted from 127.0.0.1:51347 #1 (1 connection now open)
[conn1] build index test.coll { _fts: "text", _ftsx: 1 }
[conn1] Index: (1/3) External Sort Progress: 3500/6245 56%
[conn1] Index: (1/3) External Sort Progress: 5400/6245 86%
[conn1] external sort used : 413 files in 25 secs
[conn1] Index: (2/3) BTree Bottom Up Progress: 185800/2616966 7%
[conn1] Index: (2/3) BTree Bottom Up Progress: 401900/2616966 15%
[conn1] Index: (2/3) BTree Bottom Up Progress: 554200/2616966 21%
[conn1] Index: (2/3) BTree Bottom Up Progress: 769700/2616966 29%
[conn1] Index: (2/3) BTree Bottom Up Progress: 973700/2616966 37%
[conn1] Index: (2/3) BTree Bottom Up Progress: 1175400/2616966 44%
[conn1] Index: (2/3) BTree Bottom Up Progress: 1380700/2616966 52%
[conn1] Index: (2/3) BTree Bottom Up Progress: 1588900/2616966 60%
[conn1] Index: (2/3) BTree Bottom Up Progress: 1794900/2616966 68%
[conn1] Index: (2/3) BTree Bottom Up Progress: 1936500/2616966 73%
[conn1] Index: (2/3) BTree Bottom Up Progress: 2125800/2616966 81%
[conn1] Index: (2/3) BTree Bottom Up Progress: 2315800/2616966 88%
[conn1] Index: (2/3) BTree Bottom Up Progress: 2528700/2616966 96%
[conn1] done building bottom layer, going to commit
[conn1] build index done. scanned 6245 total records. 160.617 secs
[conn1] insert test.system.indexes ninserted:1 keyUpdates:0 locks(micros) w:160642416 160645ms
Check indexes.
db.coll.getIndexes()
[
{
"v" : 1,
"key" : {
"_id" : 1
},
"ns" : "test.coll",
"name" : "_id_"
},
{
"v" : 1,
"key" : {
"_fts" : "text",
"_ftsx" : 1
},
"ns" : "test.coll",
"name" : "content_text",
"weights" : {
"content" : 1
},
"default_language" : "english",
"language_override" : "language",
"textIndexVersion" : 1
}
]
Check index size. It's about half the text size it indexed.
db.coll.stats()
{
"ns" : "test.coll",
"count" : 6245,
"size" : 69054068,
"avgObjSize" : 11057.496877502002,
"storageSize" : 178520064,
"numExtents" : 12,
"nindexes" : 4,
"lastExtentSize" : 49213440,
"paddingFactor" : 1.0000000000003018,
"systemFlags" : 0,
"userFlags" : 1,
"totalIndexSize" : 86314032,
"indexSizes" : {
"_id_" : 212576,
"content_text" : 85381968
},
"ok" : 1
}
Have a test.
db.coll.runCommand("text", {search:'Hello'})
{
"queryDebugString" : "hello||||||",
"language" : "english",
"results" : []
"stats" : {
"nscanned" : 4,
"nscannedObjects" : 0,
"n" : 4,
"nfound" : 4,
"timeMicros" : 157
},
"ok" : 1
}
Not bad.
Wednesday, April 03, 2013
Wednesday, March 06, 2013
Nobody is gonna stop Andrew Morton from singing "la la la"
I'm gonna stick my fingers in my ears and sing "la la la" until people tell me "I set swappiness to zero and it didn't do what I wanted it to do".
https://lwn.net/Articles/83593/
swappiness==0 doesn't mean swap is turned off. If you want to turn off swap, remove swap partition / file. When you don't have swap partition / file, the value of swappiness doesn't matter any more.
Luckily, the misleading swappiness==0 will be changed soon.
... with current reclaim implementation, the kernel may swap out even if we set swappiness=0 and there is pagecache in RAM.
This patch changes the behavior with swappiness==0. If we set swappiness==0, the kernel does not swap out completely ...
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=fe35004fbf9eaf67482b074a2e032abb9c89b1dd;hp=c50ac050811d6485616a193eb0f37bfbd191cc89
Andrew, soon you can stick your fingers in your ears and sing "la la la" forever, as no one will tell you "I set swappiness to zero and it didn't do what I wanted it to do".
Subscribe to:
Posts (Atom)