source: trunk/src/org/expeditee/greenstone/Query.java@ 1443

Last change on this file since 1443 was 919, checked in by jts21, 10 years ago

Added license headers to all files, added full GPL3 license file, moved license header generator script to dev/bin/scripts

File size: 3.8 KB
Line 
1/**
2 * Query.java
3 * Copyright (C) 2010 New Zealand Digital Library, http://expeditee.org
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19package org.expeditee.greenstone;
20
21
22public class Query implements Cloneable
23{
24 private String queryText;
25 private String stemming;
26 private String casefolding;
27 private String maxDocsToReturn;
28 private String sortBy;
29 private String matchMode;
30 private String index;
31 private String firstDoc;
32 private String lastDoc;
33
34 private QueryOutcome queryOutcome;
35
36 public Query()
37 {
38 queryText = "the";
39 stemming = "0";
40 casefolding = "1";
41 maxDocsToReturn = "5";
42 sortBy = "1";
43 matchMode = "all";
44 index = "TX";
45 firstDoc = "0";
46 lastDoc = "0";
47
48 queryOutcome = new QueryOutcome();
49 }
50
51 public Query clone() {
52 try {
53 return (Query)super.clone();
54 }
55 catch (CloneNotSupportedException e) {
56 throw new InternalError(e.toString());
57 }
58 }
59
60 public String toString() {
61 String dump = "\nqueryText\t" + this.queryText + "\nstemming\t" + stemming + "\ncasefolding\t" + casefolding + "\nmaxDocs\t\t" + maxDocsToReturn;
62 dump = dump + "\nsortBy\t\t" + sortBy + "\nmatchMode\t" + matchMode + "\nindex\t\t" + index;
63 dump = dump + "\nfirstDoc\t" + firstDoc + "\nlastDoc\t\t" + lastDoc + "\n";
64
65 return dump + queryOutcome.toString();
66 }
67
68 public void setQueryText(String queryText) {
69 this.queryText = new String(queryText);
70 }
71
72 public void setStemming(String stemming) {
73 this.stemming = new String(stemming);
74 }
75
76 public void setCasefolding(String casefolding) {
77 this.casefolding = new String(casefolding);
78 }
79
80 public void setMaxDocsToReturn(String maxDocsToReturn) {
81 this.maxDocsToReturn = new String(maxDocsToReturn);
82 }
83/*
84 public void setSortBy(String sortBy) {
85 this.sortBy = new String(sortBy);
86 }
87*/
88
89 public void setMatchMode(String matchMode) {
90 this.matchMode = new String(matchMode);
91 }
92
93 public void setIndex(String index) {
94 this.index = new String(index);
95 }
96
97 public void setFirstDoc(String firstDoc) {
98 this.firstDoc = new String(firstDoc);
99 }
100
101 public void setLastDoc(String lastDoc) {
102 this.lastDoc = new String(lastDoc);
103 }
104
105
106 public void addQueryOutcome(QueryOutcome queryOutcome) {
107 this.queryOutcome = queryOutcome;
108 }
109
110
111
112
113 public String getQueryText() {
114 return this.queryText;
115 }
116
117 public String getStemming() {
118 return this.stemming;
119 }
120
121 public String getCasefolding() {
122 return this.casefolding;
123 }
124
125 public String getMaxDocsToReturn() {
126 return this.maxDocsToReturn;
127 }
128
129 public String getSortBy() {
130 return this.sortBy;
131 }
132
133 public String getMatchMode() {
134 return this.matchMode;
135 }
136
137 public String getIndex() {
138 return this.index;
139 }
140
141 public String getFirstDoc() {
142 return this.firstDoc;
143 }
144
145 public String getLastDoc() {
146 return this.lastDoc;
147 }
148
149
150 public QueryOutcome getQueryOutcome() {
151 return this.queryOutcome;
152 }
153}
Note: See TracBrowser for help on using the repository browser.