01: package org.apache.lucene.benchmark.standard;
02:
03: import org.apache.lucene.index.Term;
04: import org.apache.lucene.search.Query;
05: import org.apache.lucene.search.WildcardQuery;
06: import org.apache.lucene.search.spans.SpanFirstQuery;
07: import org.apache.lucene.search.spans.SpanNearQuery;
08: import org.apache.lucene.search.spans.SpanQuery;
09: import org.apache.lucene.search.spans.SpanTermQuery;
10:
11: /**
12: * Copyright 2005 The Apache Software Foundation
13: *
14: * Licensed under the Apache License, Version 2.0 (the "License");
15: * you may not use this file except in compliance with the License.
16: * You may obtain a copy of the License at
17: *
18: * http://www.apache.org/licenses/LICENSE-2.0
19: *
20: * Unless required by applicable law or agreed to in writing, software
21: * distributed under the License is distributed on an "AS IS" BASIS,
22: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23: * See the License for the specific language governing permissions and
24: * limitations under the License.
25: */
26:
27: /**
28: * @deprecated Use Task based benchmarker
29: *
30: **/
31: public class ReutersQueries {
32: public static String[] STANDARD_QUERIES = {
33: //Start with some short queries
34: "Salomon",
35: "Comex",
36: "night trading",
37: "Japan Sony",
38: //Try some Phrase Queries
39: "\"Sony Japan\"",
40: "\"food needs\"~3",
41: "\"World Bank\"^2 AND Nigeria",
42: "\"World Bank\" -Nigeria",
43: "\"Ford Credit\"~5",
44: //Try some longer queries
45: "airline Europe Canada destination",
46: "Long term pressure by trade "
47: + "ministers is necessary if the current Uruguay round of talks on "
48: + "the General Agreement on Trade and Tariffs (GATT) is to "
49: + "succeed" };
50:
51: public static Query[] getPrebuiltQueries(String field) {
52: //be wary of unanalyzed text
53: return new Query[] {
54: new SpanFirstQuery(new SpanTermQuery(new Term(field,
55: "ford")), 5),
56: new SpanNearQuery(
57: new SpanQuery[] {
58: new SpanTermQuery(new Term(field,
59: "night")),
60: new SpanTermQuery(new Term(field,
61: "trading")) }, 4, false),
62: new SpanNearQuery(new SpanQuery[] {
63: new SpanFirstQuery(new SpanTermQuery(new Term(
64: field, "ford")), 10),
65: new SpanTermQuery(new Term(field, "credit")) },
66: 10, false),
67: new WildcardQuery(new Term(field, "fo*")), };
68: }
69: }
|