code_zauker 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/czsearch +4 -3
- data/etc/redis-win.conf +496 -0
- data/lib/code_zauker.rb +8 -18
- data/lib/code_zauker/version.rb +1 -1
- data/readme.org +19 -13
- data/test/test_search.rb +1 -1
- metadata +17 -16
data/bin/czsearch
CHANGED
@@ -100,11 +100,12 @@ ARGV.each do | s |
|
|
100
100
|
files= r[:files]
|
101
101
|
pattern=r[:regexp]
|
102
102
|
else
|
103
|
-
|
104
|
-
|
103
|
+
# It uses always isearch
|
104
|
+
# and delegates to the grep subsystem to find it out
|
105
|
+
files=fs.isearch(s)
|
106
|
+
if options[:ignorecase]==false
|
105
107
|
pattern=/#{Regexp.escape(s)}/
|
106
108
|
else
|
107
|
-
files=fs.isearch(s)
|
108
109
|
pattern=/#{Regexp.escape(s)}/i
|
109
110
|
end
|
110
111
|
end
|
data/etc/redis-win.conf
ADDED
@@ -0,0 +1,496 @@
|
|
1
|
+
# Redis configuration file fro Code Zauker
|
2
|
+
|
3
|
+
# Note on units: when memory size is needed, it is possible to specifiy
|
4
|
+
# it in the usual form of 1k 5GB 4M and so forth:
|
5
|
+
#
|
6
|
+
# 1k => 1000 bytes
|
7
|
+
# 1kb => 1024 bytes
|
8
|
+
# 1m => 1000000 bytes
|
9
|
+
# 1mb => 1024*1024 bytes
|
10
|
+
# 1g => 1000000000 bytes
|
11
|
+
# 1gb => 1024*1024*1024 bytes
|
12
|
+
#
|
13
|
+
# units are case insensitive so 1GB 1Gb 1gB are all the same.
|
14
|
+
|
15
|
+
# By default Redis does not run as a daemon. Use 'yes' if you need it.
|
16
|
+
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
|
17
|
+
daemonize yes
|
18
|
+
|
19
|
+
# When running daemonized, Redis writes a pid file in /var/run/redis.pid by
|
20
|
+
# default. You can specify a custom pid file location here.
|
21
|
+
pidfile C:/TEMP/codezauker_redis.pid
|
22
|
+
|
23
|
+
# Accept connections on the specified port, default is 6379.
|
24
|
+
# If port 0 is specified Redis will not listen on a TCP socket.
|
25
|
+
#port 6379
|
26
|
+
# Another port if you run a VM like me
|
27
|
+
port 6380
|
28
|
+
|
29
|
+
# If you want you can bind a single interface, if the bind option is not
|
30
|
+
# specified all the interfaces will listen for incoming connections.
|
31
|
+
#
|
32
|
+
# bind 127.0.0.1
|
33
|
+
|
34
|
+
# Specify the path for the unix socket that will be used to listen for
|
35
|
+
# incoming connections. There is no default, so Redis will not listen
|
36
|
+
# on a unix socket when not specified.
|
37
|
+
#
|
38
|
+
# unixsocket /tmp/redis.sock
|
39
|
+
# unixsocketperm 755
|
40
|
+
|
41
|
+
# Close the connection after a client is idle for N seconds (0 to disable)
|
42
|
+
timeout 0
|
43
|
+
|
44
|
+
# Set server verbosity to 'debug'
|
45
|
+
# it can be one of:
|
46
|
+
# debug (a lot of information, useful for development/testing)
|
47
|
+
# verbose (many rarely useful info, but not a mess like the debug level)
|
48
|
+
# notice (moderately verbose, what you want in production probably)
|
49
|
+
# warning (only very important / critical messages are logged)
|
50
|
+
loglevel notice
|
51
|
+
|
52
|
+
# Specify the log file name. Also 'stdout' can be used to force
|
53
|
+
# Redis to log on the standard output. Note that if you use standard
|
54
|
+
# output for logging but daemonize, logs will be sent to /dev/null
|
55
|
+
#logfile stdout
|
56
|
+
logfile C:/temp/redis.log
|
57
|
+
|
58
|
+
# To enable logging to the system logger, just set 'syslog-enabled' to yes,
|
59
|
+
# and optionally update the other syslog parameters to suit your needs.
|
60
|
+
# syslog-enabled no
|
61
|
+
|
62
|
+
# Specify the syslog identity.
|
63
|
+
# syslog-ident redis
|
64
|
+
|
65
|
+
# Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.
|
66
|
+
# syslog-facility local0
|
67
|
+
|
68
|
+
# Set the number of databases. The default database is DB 0, you can select
|
69
|
+
# a different one on a per-connection basis using SELECT <dbid> where
|
70
|
+
# dbid is a number between 0 and 'databases'-1
|
71
|
+
databases 16
|
72
|
+
|
73
|
+
################################ SNAPSHOTTING #################################
|
74
|
+
#
|
75
|
+
# Save the DB on disk:
|
76
|
+
#
|
77
|
+
# save <seconds> <changes>
|
78
|
+
#
|
79
|
+
# Will save the DB if both the given number of seconds and the given
|
80
|
+
# number of write operations against the DB occurred.
|
81
|
+
#
|
82
|
+
# In the example below the behaviour will be to save:
|
83
|
+
# after 900 sec (15 min) if at least 1 key changed
|
84
|
+
# after 300 sec (5 min) if at least 10 keys changed
|
85
|
+
# after 60 sec if at least 10000 keys changed
|
86
|
+
#
|
87
|
+
# Note: you can disable saving at all commenting all the "save" lines.
|
88
|
+
|
89
|
+
save 900 100
|
90
|
+
save 300 1000
|
91
|
+
# Incresed minute saver, to improve performance
|
92
|
+
#save 60 10000
|
93
|
+
save 60 60000000
|
94
|
+
|
95
|
+
# Compress string objects using LZF when dump .rdb databases?
|
96
|
+
# For default that's set to 'yes' as it's almost always a win.
|
97
|
+
# If you want to save some CPU in the saving child set it to 'no' but
|
98
|
+
# the dataset will likely be bigger if you have compressible values or keys.
|
99
|
+
rdbcompression yes
|
100
|
+
|
101
|
+
# The filename where to dump the DB
|
102
|
+
dbfilename code_zauker_index.rdb
|
103
|
+
|
104
|
+
# The working directory.
|
105
|
+
#
|
106
|
+
# The DB will be written inside this directory, with the filename specified
|
107
|
+
# above using the 'dbfilename' configuration directive.
|
108
|
+
#
|
109
|
+
# Also the Append Only File will be created inside this directory.
|
110
|
+
#
|
111
|
+
# Note that you must specify a directory here, not a file name.
|
112
|
+
#dir ./
|
113
|
+
dir C:\temp\redis
|
114
|
+
|
115
|
+
|
116
|
+
################################# REPLICATION #################################
|
117
|
+
|
118
|
+
# Master-Slave replication. Use slaveof to make a Redis instance a copy of
|
119
|
+
# another Redis server. Note that the configuration is local to the slave
|
120
|
+
# so for example it is possible to configure the slave to save the DB with a
|
121
|
+
# different interval, or to listen to another port, and so on.
|
122
|
+
#
|
123
|
+
# slaveof <masterip> <masterport>
|
124
|
+
|
125
|
+
# If the master is password protected (using the "requirepass" configuration
|
126
|
+
# directive below) it is possible to tell the slave to authenticate before
|
127
|
+
# starting the replication synchronization process, otherwise the master will
|
128
|
+
# refuse the slave request.
|
129
|
+
#
|
130
|
+
# masterauth <master-password>
|
131
|
+
|
132
|
+
# When a slave lost the connection with the master, or when the replication
|
133
|
+
# is still in progress, the slave can act in two different ways:
|
134
|
+
#
|
135
|
+
# 1) if slave-serve-stale-data is set to 'yes' (the default) the slave will
|
136
|
+
# still reply to client requests, possibly with out of data data, or the
|
137
|
+
# data set may just be empty if this is the first synchronization.
|
138
|
+
#
|
139
|
+
# 2) if slave-serve-stale data is set to 'no' the slave will reply with
|
140
|
+
# an error "SYNC with master in progress" to all the kind of commands
|
141
|
+
# but to INFO and SLAVEOF.
|
142
|
+
#
|
143
|
+
slave-serve-stale-data yes
|
144
|
+
|
145
|
+
# Slaves send PINGs to server in a predefined interval. It's possible to change
|
146
|
+
# this interval with the repl_ping_slave_period option. The default value is 10
|
147
|
+
# seconds.
|
148
|
+
#
|
149
|
+
# repl-ping-slave-period 10
|
150
|
+
|
151
|
+
# The following option sets a timeout for both Bulk transfer I/O timeout and
|
152
|
+
# master data or ping response timeout. The default value is 60 seconds.
|
153
|
+
#
|
154
|
+
# It is important to make sure that this value is greater than the value
|
155
|
+
# specified for repl-ping-slave-period otherwise a timeout will be detected
|
156
|
+
# every time there is low traffic between the master and the slave.
|
157
|
+
#
|
158
|
+
# repl-timeout 60
|
159
|
+
|
160
|
+
################################## SECURITY ###################################
|
161
|
+
|
162
|
+
# Require clients to issue AUTH <PASSWORD> before processing any other
|
163
|
+
# commands. This might be useful in environments in which you do not trust
|
164
|
+
# others with access to the host running redis-server.
|
165
|
+
#
|
166
|
+
# This should stay commented out for backward compatibility and because most
|
167
|
+
# people do not need auth (e.g. they run their own servers).
|
168
|
+
#
|
169
|
+
# Warning: since Redis is pretty fast an outside user can try up to
|
170
|
+
# 150k passwords per second against a good box. This means that you should
|
171
|
+
# use a very strong password otherwise it will be very easy to break.
|
172
|
+
#
|
173
|
+
# requirepass foobared
|
174
|
+
|
175
|
+
# Command renaming.
|
176
|
+
#
|
177
|
+
# It is possilbe to change the name of dangerous commands in a shared
|
178
|
+
# environment. For instance the CONFIG command may be renamed into something
|
179
|
+
# of hard to guess so that it will be still available for internal-use
|
180
|
+
# tools but not available for general clients.
|
181
|
+
#
|
182
|
+
# Example:
|
183
|
+
#
|
184
|
+
# rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52
|
185
|
+
#
|
186
|
+
# It is also possilbe to completely kill a command renaming it into
|
187
|
+
# an empty string:
|
188
|
+
#
|
189
|
+
# rename-command CONFIG ""
|
190
|
+
|
191
|
+
################################### LIMITS ####################################
|
192
|
+
|
193
|
+
# Set the max number of connected clients at the same time. By default there
|
194
|
+
# is no limit, and it's up to the number of file descriptors the Redis process
|
195
|
+
# is able to open. The special value '0' means no limits.
|
196
|
+
# Once the limit is reached Redis will close all the new connections sending
|
197
|
+
# an error 'max number of clients reached'.
|
198
|
+
#
|
199
|
+
# maxclients 128
|
200
|
+
|
201
|
+
# GG Strict maxclients for seacurity
|
202
|
+
maxclients 64
|
203
|
+
|
204
|
+
# Don't use more memory than the specified amount of bytes.
|
205
|
+
# When the memory limit is reached Redis will try to remove keys with an
|
206
|
+
# EXPIRE set. It will try to start freeing keys that are going to expire
|
207
|
+
# in little time and preserve keys with a longer time to live.
|
208
|
+
# Redis will also try to remove objects from free lists if possible.
|
209
|
+
#
|
210
|
+
# If all this fails, Redis will start to reply with errors to commands
|
211
|
+
# that will use more memory, like SET, LPUSH, and so on, and will continue
|
212
|
+
# to reply to most read-only commands like GET.
|
213
|
+
#
|
214
|
+
# WARNING: maxmemory can be a good idea mainly if you want to use Redis as a
|
215
|
+
# 'state' server or cache, not as a real DB. When Redis is used as a real
|
216
|
+
# database the memory usage will grow over the weeks, it will be obvious if
|
217
|
+
# it is going to use too much memory in the long run, and you'll have the time
|
218
|
+
# to upgrade. With maxmemory after the limit is reached you'll start to get
|
219
|
+
# errors for write operations, and this may even lead to DB inconsistency.
|
220
|
+
#
|
221
|
+
# maxmemory <bytes>
|
222
|
+
|
223
|
+
# MAXMEMORY POLICY: how Redis will select what to remove when maxmemory
|
224
|
+
# is reached? You can select among five behavior:
|
225
|
+
#
|
226
|
+
# volatile-lru -> remove the key with an expire set using an LRU algorithm
|
227
|
+
# allkeys-lru -> remove any key accordingly to the LRU algorithm
|
228
|
+
# volatile-random -> remove a random key with an expire set
|
229
|
+
# allkeys->random -> remove a random key, any key
|
230
|
+
# volatile-ttl -> remove the key with the nearest expire time (minor TTL)
|
231
|
+
# noeviction -> don't expire at all, just return an error on write operations
|
232
|
+
#
|
233
|
+
# Note: with all the kind of policies, Redis will return an error on write
|
234
|
+
# operations, when there are not suitable keys for eviction.
|
235
|
+
#
|
236
|
+
# At the date of writing this commands are: set setnx setex append
|
237
|
+
# incr decr rpush lpush rpushx lpushx linsert lset rpoplpush sadd
|
238
|
+
# sinter sinterstore sunion sunionstore sdiff sdiffstore zadd zincrby
|
239
|
+
# zunionstore zinterstore hset hsetnx hmset hincrby incrby decrby
|
240
|
+
# getset mset msetnx exec sort
|
241
|
+
#
|
242
|
+
# The default is:
|
243
|
+
#
|
244
|
+
# maxmemory-policy volatile-lru
|
245
|
+
|
246
|
+
# LRU and minimal TTL algorithms are not precise algorithms but approximated
|
247
|
+
# algorithms (in order to save memory), so you can select as well the sample
|
248
|
+
# size to check. For instance for default Redis will check three keys and
|
249
|
+
# pick the one that was used less recently, you can change the sample size
|
250
|
+
# using the following configuration directive.
|
251
|
+
#
|
252
|
+
# maxmemory-samples 3
|
253
|
+
|
254
|
+
############################## APPEND ONLY MODE ###############################
|
255
|
+
|
256
|
+
# By default Redis asynchronously dumps the dataset on disk. If you can live
|
257
|
+
# with the idea that the latest records will be lost if something like a crash
|
258
|
+
# happens this is the preferred way to run Redis. If instead you care a lot
|
259
|
+
# about your data and don't want to that a single record can get lost you should
|
260
|
+
# enable the append only mode: when this mode is enabled Redis will append
|
261
|
+
# every write operation received in the file appendonly.aof. This file will
|
262
|
+
# be read on startup in order to rebuild the full dataset in memory.
|
263
|
+
#
|
264
|
+
# Note that you can have both the async dumps and the append only file if you
|
265
|
+
# like (you have to comment the "save" statements above to disable the dumps).
|
266
|
+
# Still if append only mode is enabled Redis will load the data from the
|
267
|
+
# log file at startup ignoring the dump.rdb file.
|
268
|
+
#
|
269
|
+
# IMPORTANT: Check the BGREWRITEAOF to check how to rewrite the append
|
270
|
+
# log file in background when it gets too big.
|
271
|
+
|
272
|
+
appendonly no
|
273
|
+
|
274
|
+
# The name of the append only file (default: "appendonly.aof")
|
275
|
+
# appendfilename appendonly.aof
|
276
|
+
|
277
|
+
# The fsync() call tells the Operating System to actually write data on disk
|
278
|
+
# instead to wait for more data in the output buffer. Some OS will really flush
|
279
|
+
# data on disk, some other OS will just try to do it ASAP.
|
280
|
+
#
|
281
|
+
# Redis supports three different modes:
|
282
|
+
#
|
283
|
+
# no: don't fsync, just let the OS flush the data when it wants. Faster.
|
284
|
+
# always: fsync after every write to the append only log . Slow, Safest.
|
285
|
+
# everysec: fsync only if one second passed since the last fsync. Compromise.
|
286
|
+
#
|
287
|
+
# The default is "everysec" that's usually the right compromise between
|
288
|
+
# speed and data safety. It's up to you to understand if you can relax this to
|
289
|
+
# "no" that will will let the operating system flush the output buffer when
|
290
|
+
# it wants, for better performances (but if you can live with the idea of
|
291
|
+
# some data loss consider the default persistence mode that's snapshotting),
|
292
|
+
# or on the contrary, use "always" that's very slow but a bit safer than
|
293
|
+
# everysec.
|
294
|
+
#
|
295
|
+
# If unsure, use "everysec".
|
296
|
+
|
297
|
+
# appendfsync always
|
298
|
+
appendfsync everysec
|
299
|
+
# appendfsync no
|
300
|
+
|
301
|
+
# When the AOF fsync policy is set to always or everysec, and a background
|
302
|
+
# saving process (a background save or AOF log background rewriting) is
|
303
|
+
# performing a lot of I/O against the disk, in some Linux configurations
|
304
|
+
# Redis may block too long on the fsync() call. Note that there is no fix for
|
305
|
+
# this currently, as even performing fsync in a different thread will block
|
306
|
+
# our synchronous write(2) call.
|
307
|
+
#
|
308
|
+
# In order to mitigate this problem it's possible to use the following option
|
309
|
+
# that will prevent fsync() from being called in the main process while a
|
310
|
+
# BGSAVE or BGREWRITEAOF is in progress.
|
311
|
+
#
|
312
|
+
# This means that while another child is saving the durability of Redis is
|
313
|
+
# the same as "appendfsync none", that in pratical terms means that it is
|
314
|
+
# possible to lost up to 30 seconds of log in the worst scenario (with the
|
315
|
+
# default Linux settings).
|
316
|
+
#
|
317
|
+
# If you have latency problems turn this to "yes". Otherwise leave it as
|
318
|
+
# "no" that is the safest pick from the point of view of durability.
|
319
|
+
no-appendfsync-on-rewrite no
|
320
|
+
|
321
|
+
# Automatic rewrite of the append only file.
|
322
|
+
# Redis is able to automatically rewrite the log file implicitly calling
|
323
|
+
# BGREWRITEAOF when the AOF log size will growth by the specified percentage.
|
324
|
+
#
|
325
|
+
# This is how it works: Redis remembers the size of the AOF file after the
|
326
|
+
# latest rewrite (or if no rewrite happened since the restart, the size of
|
327
|
+
# the AOF at startup is used).
|
328
|
+
#
|
329
|
+
# This base size is compared to the current size. If the current size is
|
330
|
+
# bigger than the specified percentage, the rewrite is triggered. Also
|
331
|
+
# you need to specify a minimal size for the AOF file to be rewritten, this
|
332
|
+
# is useful to avoid rewriting the AOF file even if the percentage increase
|
333
|
+
# is reached but it is still pretty small.
|
334
|
+
#
|
335
|
+
# Specify a precentage of zero in order to disable the automatic AOF
|
336
|
+
# rewrite feature.
|
337
|
+
|
338
|
+
auto-aof-rewrite-percentage 100
|
339
|
+
auto-aof-rewrite-min-size 64mb
|
340
|
+
|
341
|
+
################################## SLOW LOG ###################################
|
342
|
+
|
343
|
+
# The Redis Slow Log is a system to log queries that exceeded a specified
|
344
|
+
# execution time. The execution time does not include the I/O operations
|
345
|
+
# like talking with the client, sending the reply and so forth,
|
346
|
+
# but just the time needed to actually execute the command (this is the only
|
347
|
+
# stage of command execution where the thread is blocked and can not serve
|
348
|
+
# other requests in the meantime).
|
349
|
+
#
|
350
|
+
# You can configure the slow log with two parameters: one tells Redis
|
351
|
+
# what is the execution time, in microseconds, to exceed in order for the
|
352
|
+
# command to get logged, and the other parameter is the length of the
|
353
|
+
# slow log. When a new command is logged the oldest one is removed from the
|
354
|
+
# queue of logged commands.
|
355
|
+
|
356
|
+
# The following time is expressed in microseconds, so 1000000 is equivalent
|
357
|
+
# to one second. Note that a negative number disables the slow log, while
|
358
|
+
# a value of zero forces the logging of every command.
|
359
|
+
slowlog-log-slower-than 10000
|
360
|
+
|
361
|
+
# There is no limit to this length. Just be aware that it will consume memory.
|
362
|
+
# You can reclaim memory used by the slow log with SLOWLOG RESET.
|
363
|
+
slowlog-max-len 1024
|
364
|
+
|
365
|
+
################################ VIRTUAL MEMORY ###############################
|
366
|
+
|
367
|
+
### WARNING! Virtual Memory is deprecated in Redis 2.4
|
368
|
+
### The use of Virtual Memory is strongly discouraged.
|
369
|
+
|
370
|
+
# Virtual Memory allows Redis to work with datasets bigger than the actual
|
371
|
+
# amount of RAM needed to hold the whole dataset in memory.
|
372
|
+
# In order to do so very used keys are taken in memory while the other keys
|
373
|
+
# are swapped into a swap file, similarly to what operating systems do
|
374
|
+
# with memory pages.
|
375
|
+
#
|
376
|
+
# To enable VM just set 'vm-enabled' to yes, and set the following three
|
377
|
+
# VM parameters accordingly to your needs.
|
378
|
+
|
379
|
+
vm-enabled no
|
380
|
+
# vm-enabled yes
|
381
|
+
|
382
|
+
# This is the path of the Redis swap file. As you can guess, swap files
|
383
|
+
# can't be shared by different Redis instances, so make sure to use a swap
|
384
|
+
# file for every redis process you are running. Redis will complain if the
|
385
|
+
# swap file is already in use.
|
386
|
+
#
|
387
|
+
# The best kind of storage for the Redis swap file (that's accessed at random)
|
388
|
+
# is a Solid State Disk (SSD).
|
389
|
+
#
|
390
|
+
# *** WARNING *** if you are using a shared hosting the default of putting
|
391
|
+
# the swap file under /tmp is not secure. Create a dir with access granted
|
392
|
+
# only to Redis user and configure Redis to create the swap file there.
|
393
|
+
vm-swap-file /tmp/redis.swap
|
394
|
+
|
395
|
+
# vm-max-memory configures the VM to use at max the specified amount of
|
396
|
+
# RAM. Everything that deos not fit will be swapped on disk *if* possible, that
|
397
|
+
# is, if there is still enough contiguous space in the swap file.
|
398
|
+
#
|
399
|
+
# With vm-max-memory 0 the system will swap everything it can. Not a good
|
400
|
+
# default, just specify the max amount of RAM you can in bytes, but it's
|
401
|
+
# better to leave some margin. For instance specify an amount of RAM
|
402
|
+
# that's more or less between 60 and 80% of your free RAM.
|
403
|
+
vm-max-memory 0
|
404
|
+
|
405
|
+
# Redis swap files is split into pages. An object can be saved using multiple
|
406
|
+
# contiguous pages, but pages can't be shared between different objects.
|
407
|
+
# So if your page is too big, small objects swapped out on disk will waste
|
408
|
+
# a lot of space. If you page is too small, there is less space in the swap
|
409
|
+
# file (assuming you configured the same number of total swap file pages).
|
410
|
+
#
|
411
|
+
# If you use a lot of small objects, use a page size of 64 or 32 bytes.
|
412
|
+
# If you use a lot of big objects, use a bigger page size.
|
413
|
+
# If unsure, use the default :)
|
414
|
+
vm-page-size 32
|
415
|
+
|
416
|
+
# Number of total memory pages in the swap file.
|
417
|
+
# Given that the page table (a bitmap of free/used pages) is taken in memory,
|
418
|
+
# every 8 pages on disk will consume 1 byte of RAM.
|
419
|
+
#
|
420
|
+
# The total swap size is vm-page-size * vm-pages
|
421
|
+
#
|
422
|
+
# With the default of 32-bytes memory pages and 134217728 pages Redis will
|
423
|
+
# use a 4 GB swap file, that will use 16 MB of RAM for the page table.
|
424
|
+
#
|
425
|
+
# It's better to use the smallest acceptable value for your application,
|
426
|
+
# but the default is large in order to work in most conditions.
|
427
|
+
vm-pages 134217728
|
428
|
+
|
429
|
+
# Max number of VM I/O threads running at the same time.
|
430
|
+
# This threads are used to read/write data from/to swap file, since they
|
431
|
+
# also encode and decode objects from disk to memory or the reverse, a bigger
|
432
|
+
# number of threads can help with big objects even if they can't help with
|
433
|
+
# I/O itself as the physical device may not be able to couple with many
|
434
|
+
# reads/writes operations at the same time.
|
435
|
+
#
|
436
|
+
# The special value of 0 turn off threaded I/O and enables the blocking
|
437
|
+
# Virtual Memory implementation.
|
438
|
+
vm-max-threads 4
|
439
|
+
|
440
|
+
############################### ADVANCED CONFIG ###############################
|
441
|
+
|
442
|
+
# Hashes are encoded in a special way (much more memory efficient) when they
|
443
|
+
# have at max a given numer of elements, and the biggest element does not
|
444
|
+
# exceed a given threshold. You can configure this limits with the following
|
445
|
+
# configuration directives.
|
446
|
+
hash-max-zipmap-entries 512
|
447
|
+
hash-max-zipmap-value 64
|
448
|
+
|
449
|
+
# Similarly to hashes, small lists are also encoded in a special way in order
|
450
|
+
# to save a lot of space. The special representation is only used when
|
451
|
+
# you are under the following limits:
|
452
|
+
list-max-ziplist-entries 512
|
453
|
+
list-max-ziplist-value 64
|
454
|
+
|
455
|
+
# Sets have a special encoding in just one case: when a set is composed
|
456
|
+
# of just strings that happens to be integers in radix 10 in the range
|
457
|
+
# of 64 bit signed integers.
|
458
|
+
# The following configuration setting sets the limit in the size of the
|
459
|
+
# set in order to use this special memory saving encoding.
|
460
|
+
set-max-intset-entries 512
|
461
|
+
|
462
|
+
# Similarly to hashes and lists, sorted sets are also specially encoded in
|
463
|
+
# order to save a lot of space. This encoding is only used when the length and
|
464
|
+
# elements of a sorted set are below the following limits:
|
465
|
+
zset-max-ziplist-entries 128
|
466
|
+
zset-max-ziplist-value 64
|
467
|
+
|
468
|
+
# Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in
|
469
|
+
# order to help rehashing the main Redis hash table (the one mapping top-level
|
470
|
+
# keys to values). The hash table implementation redis uses (see dict.c)
|
471
|
+
# performs a lazy rehashing: the more operation you run into an hash table
|
472
|
+
# that is rhashing, the more rehashing "steps" are performed, so if the
|
473
|
+
# server is idle the rehashing is never complete and some more memory is used
|
474
|
+
# by the hash table.
|
475
|
+
#
|
476
|
+
# The default is to use this millisecond 10 times every second in order to
|
477
|
+
# active rehashing the main dictionaries, freeing memory when possible.
|
478
|
+
#
|
479
|
+
# If unsure:
|
480
|
+
# use "activerehashing no" if you have hard latency requirements and it is
|
481
|
+
# not a good thing in your environment that Redis can reply form time to time
|
482
|
+
# to queries with 2 milliseconds delay.
|
483
|
+
#
|
484
|
+
# use "activerehashing yes" if you don't have such hard requirements but
|
485
|
+
# want to free memory asap when possible.
|
486
|
+
activerehashing yes
|
487
|
+
|
488
|
+
################################## INCLUDES ###################################
|
489
|
+
|
490
|
+
# Include one or more other config files here. This is useful if you
|
491
|
+
# have a standard template that goes to all redis server but also need
|
492
|
+
# to customize a few per-server settings. Include files can include
|
493
|
+
# other files, so use this wisely.
|
494
|
+
#
|
495
|
+
# include /path/to/local.conf
|
496
|
+
# include /path/to/other.conf
|
data/lib/code_zauker.rb
CHANGED
@@ -213,11 +213,9 @@ module CodeZauker
|
|
213
213
|
# changing multi into pipielined
|
214
214
|
@redis.pipelined do
|
215
215
|
s.each do | trigram |
|
216
|
-
@redis.sadd "trigram:#{trigram}",fid
|
217
|
-
@redis.sadd "fscan:trigramsOnFile:#{fid}", trigram
|
218
|
-
# Add the case-insensitive-trigram
|
219
216
|
begin
|
220
217
|
@redis.sadd "trigram:ci:#{trigram.downcase}",fid
|
218
|
+
@redis.sadd "fscan:trigramsOnFile:#{fid}", trigram
|
221
219
|
rescue ArgumentError
|
222
220
|
error=true
|
223
221
|
end
|
@@ -327,6 +325,9 @@ module CodeZauker
|
|
327
325
|
# "trigram:ci:*"
|
328
326
|
# all downcase
|
329
327
|
def isearch(term)
|
328
|
+
if term.length < GRAM_SIZE
|
329
|
+
raise "FATAL: #{term} is shorter then the minimum size of #{GRAM_SIZE} character"
|
330
|
+
end
|
330
331
|
termLowercase=term.downcase()
|
331
332
|
trigramInAnd=split_in_trigrams(termLowercase,"trigram:ci")
|
332
333
|
if trigramInAnd.length==0
|
@@ -375,20 +376,10 @@ module CodeZauker
|
|
375
376
|
# = search
|
376
377
|
# Find a list of file candidates to a search string
|
377
378
|
# The search string is padded into trigrams
|
379
|
+
# Starting from 0.0.9 is case insensitive and
|
380
|
+
# equal to isearch
|
378
381
|
def search(term)
|
379
|
-
|
380
|
-
raise "FATAL: #{term} is shorter then the minimum size of #{GRAM_SIZE} character"
|
381
|
-
end
|
382
|
-
#puts " ** Searching: #{term}"
|
383
|
-
trigramInAnd=split_in_trigrams(term,"trigram")
|
384
|
-
#puts "Trigam conversion /#{term}/ into #{trigramInAnd}"
|
385
|
-
if trigramInAnd.length==0
|
386
|
-
return []
|
387
|
-
end
|
388
|
-
fileIds= @redis.sinter(*trigramInAnd)
|
389
|
-
fileNames=map_ids_to_files(fileIds)
|
390
|
-
#puts "DEBUG #{fileIds} #{fileNames}"
|
391
|
-
return fileNames
|
382
|
+
return self.isearch(term)
|
392
383
|
end
|
393
384
|
|
394
385
|
def reindex(fileList)
|
@@ -431,8 +422,7 @@ module CodeZauker
|
|
431
422
|
puts "?Nothing to do on #{filename}"
|
432
423
|
end
|
433
424
|
puts "#{filename} id=#{fid} Trigrams: #{trigramsToExpurge.length} Expurging..."
|
434
|
-
trigramsToExpurge.each do | ts |
|
435
|
-
@redis.srem "trigram:#{ts}", fid
|
425
|
+
trigramsToExpurge.each do | ts |
|
436
426
|
begin
|
437
427
|
@redis.srem "trigram:ci:#{ts.downcase}",fid
|
438
428
|
#putc "."
|
data/lib/code_zauker/version.rb
CHANGED
data/readme.org
CHANGED
@@ -66,23 +66,29 @@ Run
|
|
66
66
|
and enjoy!
|
67
67
|
|
68
68
|
|
69
|
-
* DB Version
|
70
|
-
Starting from version 0.0.8, a new index check option on czindexer
|
71
|
-
will be able to migrate database between release,
|
72
69
|
|
70
|
+
* MS-Windows Compatibility
|
71
|
+
Grab your windows redis server at
|
72
|
+
https://github.com/dmajkic/redis/downloads
|
73
|
+
Version 0.0.9 has been succesful tested with Redis 2.4.5 32bit version
|
74
|
+
You will find a
|
75
|
+
redis-win.conf example
|
76
|
+
to give you a fast-startup
|
73
77
|
|
74
78
|
|
75
79
|
* Release History
|
76
|
-
| Version | Date | Summary
|
77
|
-
|
78
|
-
| 0.0.
|
79
|
-
|
|
80
|
-
| 0.0.
|
81
|
-
| 0.0.
|
82
|
-
| 0.0.
|
83
|
-
| 0.0.
|
84
|
-
| 0.0.
|
85
|
-
| 0.0.
|
80
|
+
| Version | Date | Summary |
|
81
|
+
|---------+-------------+-------------------------------------------------------------------------------|
|
82
|
+
| 0.0.9 | 12 Oct 2012 | Removed case sensitive backend to improve space use. Er Zauker Compatibility. |
|
83
|
+
| | | Tested on MSWin |
|
84
|
+
| 0.0.8 | 04 Jun 2012 | Wildcard (*) search/better error handling of missed files/indexchecker |
|
85
|
+
| 0.0.7 | 13 May 2012 | Better documentation, mczindexer, new report command |
|
86
|
+
| 0.0.6 | 04 May 2012 | New redis-server option. Better web search with results hilight |
|
87
|
+
| 0.0.5 | 09 Apr 2012 | Added Sinatra-based web search page, featuring bootrstrap css |
|
88
|
+
| 0.0.4 | 12 Feb 2012 | PDF Searching |
|
89
|
+
| 0.0.3 | 03 Feb 2012 | Added Case insensitive search.UTF-8 trigram database |
|
90
|
+
| 0.0.2 | 29 Jan 2012 | Removed dependency on unix find for czindexer. |
|
91
|
+
| 0.0.1 | 26 Jan 2012 | First RubyGems Release (for testing purpose only) |
|
86
92
|
|
87
93
|
|
88
94
|
|
data/test/test_search.rb
CHANGED
@@ -106,7 +106,7 @@ class FileScannerBasicSearch < Test::Unit::TestCase
|
|
106
106
|
fs.load("./test/fixture/kurukku.txt", noReload=true)
|
107
107
|
flist=fs.isearch("caSeinsenSitive Search TEST.")
|
108
108
|
assert flist.include?("./test/fixture/kurukku.txt"), "Case insensitive search failed. #{flist}"
|
109
|
-
assert fs.search("
|
109
|
+
assert fs.search("CASeinsenSitivE").include?("./test/fixture/kurukku.txt"), "Search must be always insensitive"
|
110
110
|
end
|
111
111
|
|
112
112
|
def test_case_insensitive3
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: code_zauker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: yard
|
16
|
-
requirement: &
|
16
|
+
requirement: &79400240 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0.7'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *79400240
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rubyzip
|
27
|
-
requirement: &
|
27
|
+
requirement: &79399900 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0.9'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *79399900
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: hiredis
|
38
|
-
requirement: &
|
38
|
+
requirement: &79399600 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0.3'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *79399600
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: redis
|
49
|
-
requirement: &
|
49
|
+
requirement: &79399290 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '2.2'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *79399290
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: pdf-reader
|
60
|
-
requirement: &
|
60
|
+
requirement: &79398890 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.0.0
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *79398890
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: sinatra
|
71
|
-
requirement: &
|
71
|
+
requirement: &79398560 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '1.3'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *79398560
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: redis_logger
|
82
|
-
requirement: &
|
82
|
+
requirement: &79398070 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: '0.1'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *79398070
|
91
91
|
description: Code Zauker is based from ideas taken by old Google Code Search and uses
|
92
92
|
Redis as a basic platform
|
93
93
|
email:
|
@@ -134,6 +134,7 @@ files:
|
|
134
134
|
- doc/js/jquery.js
|
135
135
|
- doc/method_list.html
|
136
136
|
- doc/top-level-namespace.html
|
137
|
+
- etc/redis-win.conf
|
137
138
|
- etc/redis.conf
|
138
139
|
- htdocs/CodeZauker.gif
|
139
140
|
- htdocs/Gioorgi.gif
|