source: main/trunk/greenstone2/common-src/indexers/lucene-gs/src/org/greenstone/LuceneWrapper4/SharedSoleneQuery.java@ 29148

Last change on this file since 29148 was 29148, checked in by ak19, 10 years ago

Part of port from lucene3.3.0 to lucene4.7.2. Related to LuceneWrapper. 1. Updating the lucene-gs makefiles to allow compiling up Lucene4Wrapper.jar or Lucene3Wrapper.jar. Only the Linux Makefile.in has been tested so far. 2. Adding in the jar files necessary for Lucene4Wrapper into the lib folder's new lucene4 subfolder. 3. Updating the Lucene src code to use lucene4.7.2 instead of lucene3.3.0.

  • Property svn:executable set to *
File size: 3.4 KB
Line 
1/**********************************************************************
2 *
3 * SharedSoleneQuery.java
4 *
5 * Copyright 2004 The New Zealand Digital Library Project
6 *
7 * A component of the Greenstone digital library software
8 * from the New Zealand Digital Library Project at the
9 * University of Waikato, New Zealand.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 *
25 *********************************************************************/
26package org.greenstone.LuceneWrapper4;
27
28
29import java.io.*;
30import java.util.*;
31import java.util.regex.*;
32
33
34
35abstract public class SharedSoleneQuery
36{
37 static protected String TEXTFIELD = "TX";
38
39 protected String default_conjunction_operator = "OR";
40 protected String fuzziness = null;
41 protected String sort_field = null;
42 protected String filter_string = null;
43 protected int start_results=1;
44 protected int end_results=Integer.MAX_VALUE;
45
46 static protected PrintWriter utf8out = null;
47
48 static
49 {
50 try {
51 OutputStreamWriter osw = new OutputStreamWriter(System.out, "UTF-8");
52 utf8out = new PrintWriter(osw, true);
53 }
54 catch (UnsupportedEncodingException e) {
55 System.out.println(e);
56 }
57 }
58
59
60 public SharedSoleneQuery() {
61 // nothing currently to do in shared base class to Solr/Lucene
62 }
63
64
65 public boolean initialise() {
66 return true;
67 }
68
69 abstract public SharedSoleneQueryResult runQuery(String query_string);
70
71
72 public void setDefaultConjunctionOperator(String default_conjunction_operator) {
73 this.default_conjunction_operator = default_conjunction_operator.toUpperCase();
74 }
75
76 public String getDefaultConjunctionOperator() {
77 return this.default_conjunction_operator;
78 }
79
80 public void setEndResults(int end_results) {
81 this.end_results = end_results;
82 }
83 public int getEndResults() {
84 return this.end_results;
85 }
86
87 public void setFilterString(String filter_string) {
88 this.filter_string = filter_string;
89 }
90 public String getFilterString() {
91 return this.filter_string ;
92 }
93
94 public void setFuzziness(String fuzziness) {
95 this.fuzziness = fuzziness;
96 }
97 public String getFuzziness() {
98 return this.fuzziness;
99 }
100
101 public void setSortField(String sort_field) {
102 this.sort_field = sort_field;
103 }
104 public String getSortField() {
105 return this.sort_field;
106 }
107
108 public void setStartResults(int start_results) {
109 if (start_results < 1) {
110 start_results = 1;
111 }
112 this.start_results = start_results;
113 }
114 public int getStartResults() {
115 return this.start_results;
116 }
117
118 public void cleanUp() {
119 // nothing currently to do in shared Solr/Lucene base class
120 }
121
122 protected void finalize() throws Throwable
123 {
124 try {
125 utf8out.flush();
126 } finally {
127 super.finalize();
128 }
129 }
130
131
132
133}
134
135
Note: See TracBrowser for help on using the repository browser.