2 --- Makefile.am 3 Jun 2005 19:18:59 -0000 1.110
3 +++ Makefile.am 6 Jun 2005 15:42:57 -0000
5 $(lucenedir)/Index/SegmentTermPositions.cs \
6 $(lucenedir)/Index/SegmentTermVector.cs \
7 $(lucenedir)/Index/Term.cs \
8 + $(lucenedir)/Index/TermBuffer.cs \
9 $(lucenedir)/Index/TermDocs.cs \
10 $(lucenedir)/Index/TermEnum.cs \
11 $(lucenedir)/Index/TermFreqVector.cs \
13 --- Lucene.Net/Makefile.am 16 Aug 2004 22:01:40 -0000 1.1
14 +++ Lucene.Net/Makefile.am 6 Jun 2005 15:43:00 -0000
16 $(srcdir)/Lucene.Net/Index/SegmentTermEnum.cs \
17 $(srcdir)/Lucene.Net/Index/SegmentTermPositions.cs \
18 $(srcdir)/Lucene.Net/Index/Term.cs \
19 + $(srcdir)/Lucene.Net/Index/TermBuffer.cs \
20 $(srcdir)/Lucene.Net/Index/TermDocs.cs \
21 $(srcdir)/Lucene.Net/Index/TermEnum.cs \
22 $(srcdir)/Lucene.Net/Index/TermInfo.cs \
24 --- Lucene.Net/Index/SegmentTermEnum.cs 17 Jan 2005 19:54:29 -0000 1.2
25 +++ Lucene.Net/Index/SegmentTermEnum.cs 6 Jun 2005 15:43:00 -0000
28 internal long position = - 1;
30 - private Term term = new Term("", "");
31 + private TermBuffer termBuffer = new TermBuffer();
32 + private TermBuffer prevBuffer = new TermBuffer();
33 + private TermBuffer scratch; // used for scanning
35 private TermInfo termInfo = new TermInfo();
39 internal int indexInterval;
40 internal int skipInterval;
41 private int formatM1SkipInterval;
44 - private char[] buffer = new char[]{};
46 internal SegmentTermEnum(InputStream i, FieldInfos fis, bool isi)
50 clone.input = (InputStream) input.Clone();
51 clone.termInfo = new TermInfo(termInfo);
53 - clone.GrowBuffer(term.text.Length);
54 + clone.termBuffer = (TermBuffer) termBuffer.Clone();
55 + clone.prevBuffer = (TermBuffer) prevBuffer.Clone();
56 + clone.scratch = null;
69 - GrowBuffer(term.text.Length); // copy term text into buffer
72 /// <summary>Increments the enumeration to the next element. True if one exists.</summary>
75 if (position++ >= size - 1)
85 + prevBuffer.Set(termBuffer);
86 + termBuffer.Read(input, fieldInfos);
88 termInfo.docFreq = input.ReadVInt(); // read doc freq
89 termInfo.freqPointer += input.ReadVLong(); // read freq pointer
90 termInfo.proxPointer += input.ReadVLong(); // read prox pointer
95 - private Term ReadTerm()
97 - int start = input.ReadVInt();
98 - int length = input.ReadVInt();
99 - int totalLength = start + length;
100 - if (buffer.Length < totalLength)
101 - GrowBuffer(totalLength);
103 - input.ReadChars(buffer, start, length);
104 - return new Term(fieldInfos.FieldName(input.ReadVInt()), new System.String(buffer, 0, totalLength), false);
107 - private void GrowBuffer(int length)
108 + /** Optimized scan, without allocating new terms. */
109 + public void ScanTo(Term term)
111 - buffer = new char[length];
112 - for (int i = 0; i < term.text.Length; i++)
114 - buffer[i] = term.text[i];
115 + if (scratch == null)
116 + scratch = new TermBuffer();
118 + while (scratch.CompareTo(termBuffer) > 0 && Next()) {}
121 /// <summary>Returns the current Term in the enumeration.
124 public override Term Term()
127 + return termBuffer.ToTerm();
130 + /// <summary>Returns the previous Term in the enumeration.
131 + /// Initially null.
133 + public Term Prev() {
134 + return prevBuffer.ToTerm();
137 /// <summary>Returns the current TermInfo in the enumeration.
138 /// Initially invalid, valid after next() called for the first time.
145 \ No newline at end of file
148 --- Lucene.Net/Index/TermInfosReader.cs 17 Jan 2005 19:54:29 -0000 1.2
149 +++ Lucene.Net/Index/TermInfosReader.cs 6 Jun 2005 15:43:00 -0000
150 @@ -130,10 +130,10 @@
156 // optimize sequential access: first try scanning cached enum w/o seeking
157 SegmentTermEnum enumerator = GetEnum();
158 - if (enumerator.Term() != null && ((enumerator.prev != null && term.CompareTo(enumerator.prev) > 0) || term.CompareTo(enumerator.Term()) >= 0))
159 + if (enumerator.Term() != null && ((enumerator.Prev () != null && term.CompareTo(enumerator.Prev ()) > 0) || term.CompareTo(enumerator.Term()) >= 0))
161 int enumOffset = (int) (enumerator.position / enumerator.indexInterval) + 1;
162 if (indexTerms.Length == enumOffset || term.CompareTo(indexTerms[enumOffset]) < 0)
164 private TermInfo ScanEnum(Term term)
166 SegmentTermEnum enumerator = GetEnum();
167 - while (term.CompareTo(enumerator.Term()) > 0 && enumerator.Next())
170 + enumerator.ScanTo (term);
172 if (enumerator.Term() != null && term.CompareTo(enumerator.Term()) == 0)
173 return enumerator.TermInfo();
176 return (SegmentTermEnum) GetEnum().Clone();
180 \ No newline at end of file
183 --- /dev/null 2005-03-19 20:36:14.000000000 +0100
184 +++ Lucene.Net/Index/TermBuffer.cs 2005-06-06 17:42:47.000000000 +0200
187 + * Copyright 2004 The Apache Software Foundation
189 + * Licensed under the Apache License, Version 2.0 (the "License");
190 + * you may not use this file except in compliance with the License.
191 + * You may obtain a copy of the License at
193 + * http://www.apache.org/licenses/LICENSE-2.0
195 + * Unless required by applicable law or agreed to in writing, software
196 + * distributed under the License is distributed on an "AS IS" BASIS,
197 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
198 + * See the License for the specific language governing permissions and
199 + * limitations under the License.
202 +using InputStream = Lucene.Net.Store.InputStream;
203 +namespace Lucene.Net.Index
206 + public class TermBuffer:System.ICloneable {
207 + private static char[] NO_CHARS = new char[0];
209 + private String field;
210 + private char[] text = NO_CHARS;
211 + private int textLength;
212 + private Term term; // cached
214 + public int CompareTo(TermBuffer other)
216 + if (field == other.field) // fields are interned
217 + return CompareChars(text, textLength, other.text, other.textLength);
219 + return field.CompareTo(other.field);
222 + private static int CompareChars(char[] v1, int len1, char[] v2, int len2)
224 + int end = Math.Min(len1, len2);
225 + for (int k = 0; k < end; k++) {
232 + return len1 - len2;
235 + private void SetTextLength(int newLength)
237 + if (text.Length < newLength) {
238 + char[] newText = new char[newLength];
239 + System.Array.Copy(text, 0, newText, 0, textLength);
242 + textLength = newLength;
245 + public void Read(InputStream input, FieldInfos fieldInfos)
247 + this.term = null; // invalidate cache
248 + int start = input.ReadVInt();
249 + int length = input.ReadVInt();
250 + int totalLength = start + length;
251 + SetTextLength(totalLength);
252 + input.ReadChars(this.text, start, length);
253 + this.field = fieldInfos.FieldName(input.ReadVInt());
256 + public void Set(Term term)
258 + if (term == null) {
263 + // copy text into the buffer
264 + SetTextLength(term.Text().Length);
265 + text = term.Text().ToCharArray(0, term.Text().Length);
267 + this.field = term.Field();
271 + public void Set(TermBuffer other)
273 + SetTextLength(other.textLength);
274 + System.Array.Copy(other.text, 0, text, 0, textLength);
276 + this.field = other.field;
277 + this.term = other.term;
280 + public void Reset()
283 + this.textLength = 0;
287 + public Term ToTerm()
289 + if (field == null) // unset
293 + term = new Term(field, new String(text, 0, textLength), false);
298 + public System.Object Clone()
300 + TermBuffer clone = null;
303 + clone = (TermBuffer) base.MemberwiseClone();
305 + catch (System.Exception)
309 + clone.text = new char[text.Length];
310 + System.Array.Copy(text, 0, clone.text, 0, textLength);
317 --- /home/joe/lucene-1.4/Lucene.Net-1.4.3.RC2-001/Lucene.Net/Analysis/PorterStemmer.cs 2004-11-02 12:55:50.000000000 -0500
318 +++ ./Analysis/PorterStemmer.cs 2005-01-10 16:02:22.000000000 -0500
319 @@ -587,8 +587,12 @@ namespace Lucene.Net.Analysis
324 + // FIXED joeshaw@novell.com 10 Jan 2005 - turn off unreachable code
331 /* step6() removes a final -e if m() > 1. */
333 --- /home/joe/lucene-1.4/Lucene.Net-1.4.3.RC2-001/Lucene.Net/Analysis/Standard/StandardTokenizer.cs 2004-12-27 17:15:00.000000000 -0500
334 +++ ./Analysis/Standard/StandardTokenizer.cs 2005-01-10 16:01:51.000000000 -0500
335 @@ -101,7 +101,8 @@ namespace Lucene.Net.Analysis.Standard
336 return new Lucene.Net.Analysis.Token(token.image, token.beginColumn, token.endColumn, Lucene.Net.Analysis.Standard.StandardTokenizerConstants.tokenImage[token.kind]);
339 - throw new System.ApplicationException("Missing return statement in function");
340 + // FIXED joeshaw@novell.com 10 Jan 2005 - Turn off unreachable code
341 + //throw new System.ApplicationException("Missing return statement in function");
344 public StandardTokenizerTokenManager token_source;
345 @@ -157,8 +158,8 @@ namespace Lucene.Net.Analysis.Standard
347 private Token Jj_consume_token(int kind)
350 - if ((oldToken = token).next != null)
351 + Token oldToken = token;
352 + if (token.next != null)
355 token = token.next = token_source.GetNextToken();
357 --- /home/joe/lucene-1.4/Lucene.Net-1.4.3.RC2-001/Lucene.Net/Document/Field.cs 2004-11-02 12:56:16.000000000 -0500
358 +++ ./Document/Field.cs 2005-01-07 17:32:41.000000000 -0500
359 @@ -33,7 +33,7 @@ namespace Lucene.Net.Documents
360 private System.String name = "body";
361 private System.String stringValue = null;
362 private bool storeTermVector = false;
363 - private System.IO.StreamReader readerValue = null;
364 + private System.IO.TextReader readerValue = null;
365 private bool isStored = false;
366 private bool isIndexed = true;
367 private bool isTokenized = true;
368 @@ -143,7 +143,7 @@ namespace Lucene.Net.Documents
369 /// not stored in the index verbatim. Useful for longer text fields, like
370 /// "body". Term vector will not be stored for this Field.
372 - public static Field Text(System.String name, System.IO.StreamReader value_Renamed)
373 + public static Field Text(System.String name, System.IO.TextReader value_Renamed)
375 return Text(name, value_Renamed, false);
377 @@ -152,7 +152,7 @@ namespace Lucene.Net.Documents
378 /// not stored in the index verbatim. Useful for longer text fields, like
381 - public static Field Text(System.String name, System.IO.StreamReader value_Renamed, bool storeTermVector)
382 + public static Field Text(System.String name, System.IO.TextReader value_Renamed, bool storeTermVector)
384 Field f = new Field(name, value_Renamed);
385 f.storeTermVector = storeTermVector;
386 @@ -177,7 +177,7 @@ namespace Lucene.Net.Documents
387 /// <summary>The value of the Field as a Reader, or null. If null, the String value
388 /// is used. Exactly one of stringValue() and readerValue() must be set.
390 - public System.IO.StreamReader ReaderValue()
391 + public System.IO.TextReader ReaderValue()
395 @@ -220,7 +220,7 @@ namespace Lucene.Net.Documents
396 this.storeTermVector = storeTermVector;
399 - internal Field(System.String name, System.IO.StreamReader reader)
400 + internal Field(System.String name, System.IO.TextReader reader)
403 throw new System.ArgumentException("name cannot be null");
405 --- /home/joe/lucene-1.4/Lucene.Net-1.4.3.RC2-001/Lucene.Net/QueryParser/QueryParser.cs 2005-01-07 16:56:32.000000000 -0500
406 +++ ./QueryParser/QueryParser.cs 2005-01-10 16:03:16.000000000 -0500
407 @@ -629,7 +629,8 @@ namespace Lucene.Net.QueryParsers
411 - throw new System.ApplicationException("Missing return statement in function");
412 + // FIXED joeshaw@novell.com 10 Jan 2005 - turned off unreachable code
413 + //throw new System.ApplicationException("Missing return statement in function");
416 public int Modifiers()
417 @@ -677,7 +678,8 @@ namespace Lucene.Net.QueryParsers
421 - throw new System.ApplicationException("Missing return statement in function");
422 + // FIXED joeshaw@novell.com 10 Jan 2005 - turned off unreachable code
423 + //throw new System.ApplicationException("Missing return statement in function");
426 public Query Query(System.String field)
427 @@ -736,7 +738,8 @@ label_1_brk: ;
428 return GetBooleanQuery(clauses);
431 - throw new System.ApplicationException("Missing return statement in function");
432 + // FIXED joeshaw@novell.com 10 Jan 2005 - turned off unreachable code
433 + //throw new System.ApplicationException("Missing return statement in function");
436 public Query Clause(System.String field)
437 @@ -808,7 +811,8 @@ label_1_brk: ;
441 - throw new System.ApplicationException("Missing return statement in function");
442 + // FIXED joeshaw@novell.com 10 Jan 2005 - turned off unreachable code
443 + //throw new System.ApplicationException("Missing return statement in function");
446 public Query Term(System.String field)
447 @@ -1173,7 +1177,8 @@ label_1_brk: ;
451 - throw new System.ApplicationException("Missing return statement in function");
452 + // FIXED joeshaw@novell.com 10 Jan 2005 - turned off unreachable code
453 + //throw new System.ApplicationException("Missing return statement in function");
456 private bool Jj_2_1(int xla)
458 --- /home/joe/lucene-1.4/Lucene.Net-1.4.3.RC2-001/Lucene.Net/Search/BooleanQuery.cs 2004-12-06 12:18:16.000000000 -0500
459 +++ ./Search/BooleanQuery.cs 2005-01-07 18:05:15.000000000 -0500
460 @@ -299,9 +299,10 @@ namespace Lucene.Net.Search
461 if (GetBoost() != 1.0f)
464 - if (query == c.query)
465 - // if rewrite was no-op
466 + if (query == c.query) {
467 + // if rewrite was no-op
468 query = (Query) query.Clone(); // then clone before boost
470 query.SetBoost(GetBoost() * query.GetBoost());
474 --- /home/joe/lucene-1.4/Lucene.Net-1.4.3.RC2-001/Lucene.Net/Search/RemoteSearchable.cs 2004-11-02 13:25:20.000000000 -0500
475 +++ ./Search/RemoteSearchable.cs 2005-01-10 16:04:47.000000000 -0500
476 @@ -85,11 +85,14 @@ namespace Lucene.Net.Search
478 System.Runtime.Remoting.RemotingConfiguration.Configure("Lucene.Net.Search.RemoteSearchable.config");
479 System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(new System.Runtime.Remoting.Channels.Http.HttpChannel(1099));
480 + // FIXED joeshaw@novell.com 10 Jan 2005 - turned off unreachable code
482 // create and install a security manager
483 if (false) //{{}}// if (System.getSecurityManager() == null) // {{Aroush}} >> 'java.lang.System.getSecurityManager()'
485 //{{}}// System.setSecurityManager(new RMISecurityManager()); // {{Aroush}} >> 'java.lang.System.setSecurityManager()' and 'java.rmi.RMISecurityManager.RMISecurityManager()'
489 Lucene.Net.Search.Searchable local = new IndexSearcher(args[0]);
490 RemoteSearchable impl = new RemoteSearchable(local);
492 --- /home/joe/lucene-1.4/Lucene.Net-1.4.3.RC2-001/Lucene.Net/Search/TermQuery.cs 2004-12-06 12:00:44.000000000 -0500
493 +++ ./Search/TermQuery.cs 2005-01-07 17:59:38.000000000 -0500
494 @@ -212,7 +212,7 @@ namespace Lucene.Net.Search
496 override public System.Object Clone()
499 + return new TermQuery (this.term);
503 \ No newline at end of file
505 --- /home/joe/lucene-1.4/Lucene.Net-1.4.3.RC2-001/Lucene.Net/Store/FSDirectory.cs 2004-12-15 11:25:12.000000000 -0500
506 +++ ./Store/FSDirectory.cs 2005-01-10 16:00:59.000000000 -0500
510 using Constants = Lucene.Net.Util.Constants;
511 +using System.Diagnostics; // FIXED joeshaw@novell.com 10 Jan 2005 - for lock debugging
512 namespace Lucene.Net.Store
515 @@ -76,11 +77,16 @@ namespace Lucene.Net.Store
517 System.IO.FileStream createdFile = lockFile.Create();
519 + // ADDED joeshaw@novell.com 10 Jan 2005 Lock debugging
520 + Log ("Obtained lock {0}", lockFile.FullName);
524 + catch (Exception e)
527 + // ADDED joeshaw@novell.com 10 Jan 2005 Lock debugging
528 + Log ("Could not obtain lock {0}", lockFile.FullName);
533 public override void Release()
534 @@ -100,7 +106,12 @@ namespace Lucene.Net.Store
538 - bool generatedAux = tmpBool;
540 + // ADDED joeshaw@novell.com 10 Jan 2005 - lock debugging
542 + Log ("Released lock {0}", lockFile.FullName);
544 + Log ("Failed to release lock {0}", lockFile.FullName);
546 public override bool IsLocked()
548 @@ -130,11 +141,31 @@ namespace Lucene.Net.Store
550 private static readonly bool DISABLE_LOCKS;
552 - /// <summary> Directory specified by <code>Lucene.Net.lockdir</code>
553 - /// or <code>java.io.tmpdir</code> system property
555 - public static readonly System.String LOCK_DIR = SupportClass.AppSettings.Get("Lucene.Net.lockdir", System.IO.Path.GetTempPath());
558 + /// Get the name of the directory to use for temporary files,
559 + /// and create that directory if it doesn't already exist
561 + /// FIXED trow@ximian.com 14 May 2004 Give us control over where locks are stored
562 + /// FIXED trow@ximian.com 12 Sep 2004 make TempDirectoryName not be static
563 + private String tempDirectoryName = null;
564 + public String TempDirectoryName {
566 + if (tempDirectoryName == null) {
567 + String user_name = Environment.GetEnvironmentVariable("USER");
568 + if (user_name == null)
569 + user_name = "unknown";
570 + TempDirectoryName = "/tmp/" + user_name + "-lucene.net";
572 + return tempDirectoryName;
576 + tempDirectoryName = value;
577 + if (! System.IO.Directory.Exists (tempDirectoryName))
578 + System.IO.Directory.CreateDirectory (tempDirectoryName);
582 private static System.Security.Cryptography.MD5 DIGESTER;
584 /// <summary>A buffer optionally used in renameTo method </summary>
585 @@ -203,14 +234,8 @@ namespace Lucene.Net.Store
589 - if (LOCK_DIR == null)
591 - lockDir = directory;
595 - lockDir = new System.IO.FileInfo(LOCK_DIR);
597 + // FIXED joeshaw@novell.com 10 Jan 2005 Use TempDirectoryName to find where locks live
598 + lockDir = new System.IO.FileInfo (TempDirectoryName);
602 @@ -479,7 +504,20 @@ namespace Lucene.Net.Store
604 return new FSInputStream(new System.IO.FileInfo(System.IO.Path.Combine(directory.FullName, name)));
608 + // ADDED trow 4 June 2004
609 + static public Beagle.Util.Logger Logger = null;
610 + static private void Log (string format, params object[] args)
612 + if (Logger != null)
613 + Logger.Debug (format, args);
615 + static private void Log (Exception e)
617 + if (Logger != null)
621 /// <summary> So we can do some byte-to-hexchar conversion below</summary>
622 private static readonly char[] HEX_DIGITS = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
625 --- /home/joe/lucene-1.4/Lucene.Net-1.4.3.RC2-001/Lucene.Net/Store/Lock.cs 2004-11-02 13:26:20.000000000 -0500
626 +++ ./Store/Lock.cs 2005-01-10 15:42:13.000000000 -0500
627 @@ -59,12 +59,21 @@ namespace Lucene.Net.Store
628 bool locked = Obtain();
629 int maxSleepCount = (int) (lockWaitTimeout / LOCK_POLL_INTERVAL);
632 + // FIXED trow@ximian.com 2004 May 8
633 + // We shouldn't just fail right away if lockWaitTimeout < LOCK_POLL_INTERVAL.
634 + maxSleepCount = Math.Max (maxSleepCount, 1);
638 - if (++sleepCount == maxSleepCount)
639 + // FIXED trow@ximian.com 2004 May 8
640 + // Lock would time out before first sleep if maxSleepCount == 1
641 + if (sleepCount == maxSleepCount)
643 throw new System.IO.IOException("Lock obtain timed out: " + this.ToString());
649 System.Threading.Thread.Sleep(new System.TimeSpan((System.Int64) 10000 * LOCK_POLL_INTERVAL));
651 --- Lucene.Net/Store/FSDirectory.cs 18 Mar 2005 04:34:19 -0000 1.7
652 +++ Lucene.Net/Store/FSDirectory.cs 24 Jun 2005 18:24:17 -0000
653 @@ -367,22 +367,25 @@ namespace Lucene.Net.Store
654 /// <summary>Returns the time the named file was last modified. </summary>
655 public override long FileModified(System.String name)
657 + // FIXED joeshaw@novell.com 24 Jun 2005 - Use UTC
658 System.IO.FileInfo file = new System.IO.FileInfo(System.IO.Path.Combine(directory.FullName, name));
659 - return ((file.LastWriteTime.Ticks - 621355968000000000) / 10000);
660 + return ((file.LastWriteTimeUtc.Ticks - 621355968000000000) / 10000);
663 /// <summary>Returns the time the named file was last modified. </summary>
664 public static long FileModified(System.IO.FileInfo directory, System.String name)
666 + // FIXED joeshaw@novell.com 24 Jun 2005 - Use UTC
667 System.IO.FileInfo file = new System.IO.FileInfo(System.IO.Path.Combine(directory.FullName, name));
668 - return ((file.LastWriteTime.Ticks - 621355968000000000) / 10000);
669 + return ((file.LastWriteTimeUtc.Ticks - 621355968000000000) / 10000);
672 /// <summary>Set the modified time of an existing file to now. </summary>
673 public override void TouchFile(System.String name)
675 + // FIXED joeshaw@novell.com 24 Jun 2005 - Use UTC
676 System.IO.FileInfo file = new System.IO.FileInfo(System.IO.Path.Combine(directory.FullName, name));
677 - file.LastWriteTime = System.DateTime.Now;
678 + file.LastWriteTimeUtc = System.DateTime.UtcNow;
681 /// <summary>Returns the length in bytes of a file in the directory. </summary>
683 --- Lucene.Net/Store/RAMDirectory.cs 17 Jan 2005 19:54:31 -0000 1.2
684 +++ Lucene.Net/Store/RAMDirectory.cs 24 Jun 2005 18:24:17 -0000
685 @@ -159,9 +159,10 @@ namespace Lucene.Net.Store
686 public override void TouchFile(System.String name)
688 // final boolean MONITOR = false;
691 + // FIXED joeshaw@novell.com 24 Jun 2005 - Use UTC
692 RAMFile file = (RAMFile) files[name];
693 - long ts2, ts1 = (System.DateTime.Now.Ticks - 621355968000000000) / 10000;
694 + long ts2, ts1 = (System.DateTime.UtcNow.Ticks - 621355968000000000) / 10000;
698 @@ -171,7 +172,7 @@ namespace Lucene.Net.Store
699 catch (System.Threading.ThreadInterruptedException)
702 - ts2 = (System.DateTime.Now.Ticks - 621355968000000000) / 10000;
703 + ts2 = (System.DateTime.UtcNow.Ticks - 621355968000000000) / 10000;
708 --- Lucene.Net/Store/RAMFile.cs 17 Jan 2005 19:54:31 -0000 1.1
709 +++ Lucene.Net/Store/RAMFile.cs 24 Jun 2005 18:24:17 -0000
710 @@ -21,6 +21,7 @@ namespace Lucene.Net.Store
712 internal System.Collections.ArrayList buffers = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
713 internal long length;
714 - internal long lastModified = (System.DateTime.Now.Ticks - 621355968000000000) / 10000;
715 + // FIXED joeshaw@novell.com 24 Jun 2005 - Use UTC
716 + internal long lastModified = (System.DateTime.UtcNow.Ticks - 621355968000000000) / 10000;
720 --- Lucene.Net/Store/RAMOutputStream.cs 17 Jan 2005 19:54:31 -0000 1.1
721 +++ Lucene.Net/Store/RAMOutputStream.cs 24 Jun 2005 18:24:17 -0000
722 @@ -103,7 +103,8 @@ namespace Lucene.Net.Store
723 if (pointer > file.length)
724 file.length = pointer;
726 - file.lastModified = (System.DateTime.Now.Ticks - 621355968000000000) / 10000;
727 + // FIXED joeshaw@novell.com 24 Jun 2005 - Use UTC
728 + file.lastModified = (System.DateTime.UtcNow.Ticks - 621355968000000000) / 10000;
731 public override void Close()
732 diff -u Store/FSDirectory.cs Store/FSDirectory.cs
733 --- Store/FSDirectory.cs 30 Jun 2005 14:55:13 -0000
734 +++ Store/FSDirectory.cs 19 Jul 2005 02:29:58 -0000
737 if (Lucene.Net.Store.FSDirectory.DISABLE_LOCKS)
740 + // ADDED fhedberg@novell.com 16 Jun 2005
741 + if (Enclosing_Instance.DisableLocks)
745 if (System.IO.File.Exists(Enclosing_Instance.lockDir.FullName))
748 if (Lucene.Net.Store.FSDirectory.DISABLE_LOCKS)
751 + // ADDED fhedberg@novell.com 16 Jun 2005 - disable locks per directory
752 + if (Enclosing_Instance.DisableLocks)
756 if (System.IO.File.Exists(lockFile.FullName))
760 if (Lucene.Net.Store.FSDirectory.DISABLE_LOCKS)
763 + // ADDED fhedberg@novell.com 16 Jun 2005 - disable locks per directory
764 + if (Enclosing_Instance.DisableLocks)
768 if (System.IO.File.Exists(lockFile.FullName))
774 + // ADDED fhedberg@novell.com 16 Jun 2005 - disable locks per directory
776 + private bool disable_locks = false;
778 + public bool DisableLocks {
779 + get { return disable_locks; }
780 + set { disable_locks = value; }
783 private static System.Security.Cryptography.MD5 DIGESTER;
785 /// <summary>A buffer optionally used in renameTo method </summary>
786 @@ -204,14 +227,22 @@
789 /// CHANGED trow@novell.com 17 Mar 2005 set tmp dir at creation-time
790 + /// CHANGED fhedberg@novell.com 16 Jun 2005 - disable locks per directory
791 public static FSDirectory GetDirectory(System.String path, System.String tmpDir, bool create)
793 - return GetDirectory(new System.IO.FileInfo(path), tmpDir, create);
794 + return GetDirectory(new System.IO.FileInfo(path), tmpDir, create, false);
797 + // ADDED fhedberg@novell.com 16 Jun 2005 - disable locks per directory
798 + public static FSDirectory GetDirectory(System.String path, System.String tmpDir, bool create, bool disable_locks)
800 + return GetDirectory(new System.IO.FileInfo(path), tmpDir, create, disable_locks);
803 + // CHANGED fhedberg@novell.com 16 Jun 2005 - disable locks per directory
804 public static FSDirectory GetDirectory(System.String path, bool create)
806 - return GetDirectory(new System.IO.FileInfo(path), null, create);
807 + return GetDirectory(new System.IO.FileInfo(path), null, create, false);
810 /// <summary>Returns the directory instance for the named location.
813 /// <returns> the FSDirectory for the named file.
815 - public static FSDirectory GetDirectory(System.IO.FileInfo file, System.String tmpDir, bool create)
816 + /// CHANGED fhedberg@novell.com 16 Jun 2005 - disable locks per directory
817 + public static FSDirectory GetDirectory(System.IO.FileInfo file, System.String tmpDir, bool create, bool disable_locks)
819 file = new System.IO.FileInfo(file.FullName);
822 dir = (FSDirectory) DIRECTORIES[file];
825 - dir = new FSDirectory(file, tmpDir, create);
826 + // CHANGED fhedberg@novell.com 16 Jun 2005 - disable locks per directory
827 + dir = new FSDirectory(file, tmpDir, create, disable_locks);
828 DIRECTORIES[file] = dir;
831 @@ -251,18 +284,21 @@
835 + // CHANGED fhedberg@novell.com 16 Jun 2005 - disable locks per directory
836 public static FSDirectory GetDirectory(System.IO.FileInfo file, bool create)
838 - return GetDirectory (file, null, create);
839 + return GetDirectory (file, null, create, false);
842 private System.IO.FileInfo directory = null;
843 private int refCount;
844 private System.IO.FileInfo lockDir;
846 - private FSDirectory(System.IO.FileInfo path, string tmpDir, bool create)
847 + /// CHANGED fhedberg@novell.com 16 Jun 2005 - disable locks per directory
848 + private FSDirectory(System.IO.FileInfo path, string tmpDir, bool create, bool disable_locks)
851 + this.disable_locks = disable_locks;
853 // FIXED joeshaw@novell.com 10 Jan 2005 Use TempDirectoryName to find where locks live
854 // FIXED trow@novell.com 17 Mar 2005 A fix on the fix
858 in_Renamed = new System.IO.BinaryReader(System.IO.File.Open(old.FullName, System.IO.FileMode.Open, System.IO.FileAccess.Read));
859 - out_Renamed = new System.IO.FileStream(nu.FullName, System.IO.FileMode.Create);
860 + // FIXED trow@novell.com 18 Jul 2005
861 + // Open the FileStream w/ FileShare.ReadWrite.
862 + out_Renamed = new System.IO.FileStream(nu.FullName, System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);
863 // see if the buffer needs to be initialized. Initialization is
864 // only done on-demand since many VM's will never run into the renameTo
865 // bug and hence shouldn't waste 1K of mem for no reason.