lucene-pylucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From va...@apache.org
Subject svn commit: r1465306 - in /lucene/pylucene/trunk/samples: ./ FacetExample.py IndexFiles.py SearchFiles.py
Date Sat, 06 Apr 2013 22:32:55 GMT
Author: vajda
Date: Sat Apr  6 22:32:55 2013
New Revision: 1465306

URL: http://svn.apache.org/r1465306
Log:
improved to have more specific index directory names

Modified:
    lucene/pylucene/trunk/samples/   (props changed)
    lucene/pylucene/trunk/samples/FacetExample.py
    lucene/pylucene/trunk/samples/IndexFiles.py
    lucene/pylucene/trunk/samples/SearchFiles.py

Propchange: lucene/pylucene/trunk/samples/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Apr  6 22:32:55 2013
@@ -0,0 +1,3 @@
+*.index
+*.Index
+*.Taxonomy

Modified: lucene/pylucene/trunk/samples/FacetExample.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/samples/FacetExample.py?rev=1465306&r1=1465305&r2=1465306&view=diff
==============================================================================
--- lucene/pylucene/trunk/samples/FacetExample.py (original)
+++ lucene/pylucene/trunk/samples/FacetExample.py Sat Apr  6 22:32:55 2013
@@ -27,6 +27,9 @@ usage = """
     'drilldown' => run faceted search with drilldown
 """
 
+INDEX_DIR = "FacetExample.Index"
+TAXONOMY_DIR = "FacetExample.Taxonomy"
+
 import os, sys, lucene
 
 from java.io import File
@@ -258,8 +261,10 @@ class FacetExample(object):
         # in RAM or on Disc
         #indexDir = RAMDirectory()
         #taxoDir = RAMDirectory()
-        self.indexDir = FSDirectory.open(File(os.path.join(self.directory,'Index')))
-        self.taxoDir = FSDirectory.open(File(os.path.join(self.directory,'Taxonomy')))
+        self.indexDir = FSDirectory.open(File(os.path.join(self.directory,
+                                                           INDEX_DIR)))
+        self.taxoDir = FSDirectory.open(File(os.path.join(self.directory,
+                                                          TAXONOMY_DIR)))
 
     def createIndex(self):
         # index the sample documents

Modified: lucene/pylucene/trunk/samples/IndexFiles.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/samples/IndexFiles.py?rev=1465306&r1=1465305&r2=1465306&view=diff
==============================================================================
--- lucene/pylucene/trunk/samples/IndexFiles.py (original)
+++ lucene/pylucene/trunk/samples/IndexFiles.py Sat Apr  6 22:32:55 2013
@@ -1,5 +1,7 @@
 #!/usr/bin/env python
 
+INDEX_DIR = "IndexFiles.index"
+
 import sys, os, lucene, threading, time
 from datetime import datetime
 
@@ -97,7 +99,9 @@ if __name__ == '__main__':
     print 'lucene', lucene.VERSION
     start = datetime.now()
     try:
-        IndexFiles(sys.argv[1], "index", StandardAnalyzer(Version.LUCENE_CURRENT))
+        base_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
+        IndexFiles(sys.argv[1], os.path.join(base_dir, INDEX_DIR),
+                   StandardAnalyzer(Version.LUCENE_CURRENT))
         end = datetime.now()
         print end - start
     except Exception, e:

Modified: lucene/pylucene/trunk/samples/SearchFiles.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/samples/SearchFiles.py?rev=1465306&r1=1465305&r2=1465306&view=diff
==============================================================================
--- lucene/pylucene/trunk/samples/SearchFiles.py (original)
+++ lucene/pylucene/trunk/samples/SearchFiles.py Sat Apr  6 22:32:55 2013
@@ -1,6 +1,8 @@
 #!/usr/bin/env python
 
-import lucene
+INDEX_DIR = "IndexFiles.index"
+
+import sys, os, lucene
 
 from java.io import File
 from org.apache.lucene.analysis.standard import StandardAnalyzer
@@ -40,10 +42,10 @@ def run(searcher, analyzer):
 
 
 if __name__ == '__main__':
-    STORE_DIR = "index"
     lucene.initVM()
     print 'lucene', lucene.VERSION
-    directory = SimpleFSDirectory(File(STORE_DIR))
+    base_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
+    directory = SimpleFSDirectory(File(os.path.join(base_dir, INDEX_DIR)))
     searcher = IndexSearcher(DirectoryReader.open(directory))
     analyzer = StandardAnalyzer(Version.LUCENE_CURRENT)
     run(searcher, analyzer)



Mime
View raw message