Re: Benchmark of filesystem cache for index vs RAMDirectory...

2004-08-08 Thread Daniel Naber
On Sunday 08 August 2004 03:40, Kevin A. Burton wrote:

 Would a HashMap implementation of RAMDirectory beat out a cached
 FSDirectory?

It's easy to test, so it's worth a try. Please try if the attached patch 
makes any difference for you compared to the current implementation of 
RAMDirectory.

Regards
 Daniel

-- 
http://www.danielnaber.de
Index: RAMDirectory.java
===
RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/store/RAMDirectory.java,v
retrieving revision 1.16
diff -u -r1.16 RAMDirectory.java
--- RAMDirectory.java	7 Aug 2004 11:19:28 -	1.16
+++ RAMDirectory.java	8 Aug 2004 09:01:19 -
@@ -18,8 +18,11 @@
 
 import java.io.IOException;
 import java.io.File;
+import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.Set;
 
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.InputStream;
@@ -31,7 +34,7 @@
  * @version $Id: RAMDirectory.java,v 1.16 2004/08/07 11:19:28 dnaber Exp $
  */
 public final class RAMDirectory extends Directory {
-  Hashtable files = new Hashtable();
+  HashMap files = new HashMap();
 
   /** Constructs an empty [EMAIL PROTECTED] Directory}. */
   public RAMDirectory() {
@@ -93,9 +96,11 @@
   public final String[] list() {
 String[] result = new String[files.size()];
 int i = 0;
-Enumeration names = files.keys();
-while (names.hasMoreElements())
-  result[i++] = (String)names.nextElement();
+Set names = files.keySet();
+for (Iterator iter = names.iterator(); iter.hasNext();) {
+  String element = (String) iter.next();
+  result[i++] = element;
+}
 return result;
   }
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

index and search question

2004-08-08 Thread Dmitrii PapaGeorgio
Ok so when I index a file such as below
Document doc = new Document();
doc.Add(Field.Text(contents, new StreamReader(dataDir)));
doc.Add(Field.Keyword(filename, dataDir));
I can do a search as this
+contents:SomeWord  +filename:SomePath
Correct?
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Benchmark of filesystem cache for index vs RAMDirectory...

2004-08-08 Thread Kevin A. Burton
Daniel Naber wrote:
On Sunday 08 August 2004 03:40, Kevin A. Burton wrote:
 

Would a HashMap implementation of RAMDirectory beat out a cached
FSDirectory?
   

It's easy to test, so it's worth a try. Please try if the attached patch 
makes any difference for you compared to the current implementation of 
RAMDirectory.

 

True... I was just thinking out loud... was being lazy.  Now I actually 
have to do the work to create the benchmark again... damn you ;)

Kevin
--
Please reply using PGP.
   http://peerfear.org/pubkey.asc
   
   NewsMonster - http://www.newsmonster.org/
   
Kevin A. Burton, Location - San Francisco, CA, Cell - 415.595.9965
  AIM/YIM - sfburtonator,  Web - http://peerfear.org/
GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412
 IRC - freenode.net #infoanarchy | #p2p-hackers | #newsmonster