1 |
#! /bin/sh /usr/share/dpatch/dpatch-run |
2 |
## 03_lucene.dpatch by <gregor+debian@comodo.priv.at> |
3 |
## |
4 |
## All lines beginning with `## DP:' are a description of the patch. |
5 |
## DP: some patches to use the older liblucene-java in Debian (1.4.3) |
6 |
|
7 |
@DPATCH@ |
8 |
diff -urNad libpdfbox-java~/src/org/pdfbox/searchengine/lucene/IndexFiles.java libpdfbox-java/src/org/pdfbox/searchengine/lucene/IndexFiles.java |
9 |
--- libpdfbox-java~/src/org/pdfbox/searchengine/lucene/IndexFiles.java 2006-11-18 00:09:00.000000000 +0100 |
10 |
+++ libpdfbox-java/src/org/pdfbox/searchengine/lucene/IndexFiles.java 2007-04-13 16:54:45.000000000 +0200 |
11 |
@@ -208,7 +208,7 @@ |
12 |
{ |
13 |
System.out.println("deleting " + |
14 |
HTMLDocument.uid2url(uidIter.term().text())); |
15 |
- reader.deleteDocuments(uidIter.term()); |
16 |
+ reader.delete(uidIter.term()); |
17 |
uidIter.next(); |
18 |
} |
19 |
deleting = false; |
20 |
@@ -250,7 +250,7 @@ |
21 |
{ // delete stale docs |
22 |
System.out.println("deleting " + |
23 |
HTMLDocument.uid2url(uidIter.term().text())); |
24 |
- reader.deleteDocuments(uidIter.term()); |
25 |
+ reader.delete(uidIter.term()); |
26 |
} |
27 |
uidIter.next(); |
28 |
} |
29 |
@@ -304,4 +304,4 @@ |
30 |
writer.addDocument(doc); |
31 |
} |
32 |
} |
33 |
-} |
34 |
\ No newline at end of file |
35 |
+} |
36 |
diff -urNad libpdfbox-java~/src/org/pdfbox/searchengine/lucene/LucenePDFDocument.java libpdfbox-java/src/org/pdfbox/searchengine/lucene/LucenePDFDocument.java |
37 |
--- libpdfbox-java~/src/org/pdfbox/searchengine/lucene/LucenePDFDocument.java 2006-11-18 00:09:00.000000000 +0100 |
38 |
+++ libpdfbox-java/src/org/pdfbox/searchengine/lucene/LucenePDFDocument.java 2007-04-13 16:55:30.000000000 +0200 |
39 |
@@ -44,7 +44,7 @@ |
40 |
|
41 |
import java.util.Date; |
42 |
|
43 |
-import org.apache.lucene.document.DateTools; |
44 |
+import org.apache.lucene.document.DateField; |
45 |
import org.apache.lucene.document.Document; |
46 |
import org.apache.lucene.document.Field; |
47 |
|
48 |
@@ -128,7 +128,7 @@ |
49 |
|
50 |
// given caveat of increased search times when using |
51 |
//MICROSECOND, only use SECOND by default |
52 |
- private DateTools.Resolution dateTimeResolution = DateTools.Resolution.SECOND; |
53 |
+ //private DateTools.Resolution dateTimeResolution = DateTools.Resolution.SECOND; |
54 |
|
55 |
private PDFTextStripper stripper = null; |
56 |
|
57 |
@@ -154,34 +154,40 @@ |
58 |
* |
59 |
* @return current date/time resolution |
60 |
*/ |
61 |
+ /* |
62 |
public DateTools.Resolution getDateTimeResolution() |
63 |
{ |
64 |
return dateTimeResolution; |
65 |
} |
66 |
+ */ |
67 |
|
68 |
/** |
69 |
* Set the Lucene data time resolution. |
70 |
* |
71 |
* @param resolution set new date/time resolution |
72 |
*/ |
73 |
+ /* |
74 |
public void setDateTimeResolution( DateTools.Resolution resolution ) |
75 |
{ |
76 |
dateTimeResolution = resolution; |
77 |
} |
78 |
+ */ |
79 |
|
80 |
// |
81 |
// compatibility methods for lucene-1.9+ |
82 |
// |
83 |
private String timeToString( long time ) |
84 |
{ |
85 |
- return DateTools.timeToString( time, dateTimeResolution ); |
86 |
+ //return DateTools.timeToString( time, dateTimeResolution ); |
87 |
+ return DateField.timeToString( time ); |
88 |
} |
89 |
|
90 |
private void addKeywordField( Document document, String name, String value ) |
91 |
{ |
92 |
if ( value != null ) |
93 |
{ |
94 |
- document.add( new Field( name, value, Field.Store.YES, Field.Index.UN_TOKENIZED ) ); |
95 |
+ //document.add( new Field( name, value, Field.Store.YES, Field.Index.UN_TOKENIZED ) ); |
96 |
+ document.add( new Field( name, value, true, true, false ) ); |
97 |
} |
98 |
} |
99 |
|
100 |
@@ -189,7 +195,10 @@ |
101 |
{ |
102 |
if ( value != null ) |
103 |
{ |
104 |
- document.add( new Field( name, value ) ); |
105 |
+ //document.add( new Field( name, value ) ); |
106 |
+ Field f = new Field( name, "", false, true, true ); |
107 |
+ f.Text(name, value); |
108 |
+ document.add( f ); |
109 |
} |
110 |
} |
111 |
|
112 |
@@ -197,7 +206,8 @@ |
113 |
{ |
114 |
if ( value != null ) |
115 |
{ |
116 |
- document.add( new Field( name, value, Field.Store.YES, Field.Index.TOKENIZED ) ); |
117 |
+ //document.add( new Field( name, value, Field.Store.YES, Field.Index.TOKENIZED ) ); |
118 |
+ document.add( new Field( name, value, true, true, true ) ); |
119 |
} |
120 |
} |
121 |
|
122 |
@@ -205,7 +215,8 @@ |
123 |
{ |
124 |
if ( value != null ) |
125 |
{ |
126 |
- addTextField( document, name, DateTools.dateToString( value, dateTimeResolution ) ); |
127 |
+ // addTextField( document, name, DateTools.dateToString( value, dateTimeResolution ) ); |
128 |
+ addTextField( document, name, DateField.dateToString( value ) ); |
129 |
} |
130 |
} |
131 |
|
132 |
@@ -221,7 +232,8 @@ |
133 |
{ |
134 |
if ( value != null ) |
135 |
{ |
136 |
- document.add( new Field( name, value, Field.Store.YES, Field.Index.NO ) ); |
137 |
+ // document.add( new Field( name, value, Field.Store.YES, Field.Index.NO ) ); |
138 |
+ document.add( new Field( name, value, true, false, false ) ); |
139 |
} |
140 |
} |
141 |
|
142 |
@@ -229,7 +241,8 @@ |
143 |
{ |
144 |
if ( value != null ) |
145 |
{ |
146 |
- document.add( new Field( name, value, Field.Store.NO, Field.Index.UN_TOKENIZED ) ); |
147 |
+ //document.add( new Field( name, value, Field.Store.NO, Field.Index.UN_TOKENIZED ) ); |
148 |
+ document.add( new Field( name, value, false, true, false ) ); |
149 |
} |
150 |
} |
151 |
|