~ubuntu-branches/ubuntu/trusty/pylucene/trusty

« back to all changes in this revision

Viewing changes to lucene-java-3.5.0/lucene/contrib/facet/src/examples/org/apache/lucene/facet/example/simple/SimpleUtils.java

  • Committer: Package Import Robot
  • Author(s): Dmitry Nezhevenko
  • Date: 2012-04-23 16:43:55 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120423164355-grqtepnwtecdjfk2
Tags: 3.5.0-1
* New maintainer (closes: 670179)
* New upstream release
* Switch to dpkg-source 3.0 (quilt) format
* Switch to machine-readable debian/copyright
* Bump debian/compat to 8, drop debian/pycompat
* Switch from cdbs to dh
* Add watch file
* Build for all supported versions of python2 (closes: 581198, 632240)
* Rename binary package to python-lucene (closes: 581197)
* Add -dbg package

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.apache.lucene.facet.example.simple;
 
2
 
 
3
import java.util.ArrayList;
 
4
import java.util.List;
 
5
 
 
6
import org.apache.lucene.analysis.Analyzer;
 
7
import org.apache.lucene.analysis.WhitespaceAnalyzer;
 
8
 
 
9
import org.apache.lucene.facet.example.ExampleUtils;
 
10
import org.apache.lucene.facet.taxonomy.CategoryPath;
 
11
 
 
12
/**
 
13
 * Licensed to the Apache Software Foundation (ASF) under one or more
 
14
 * contributor license agreements.  See the NOTICE file distributed with
 
15
 * this work for additional information regarding copyright ownership.
 
16
 * The ASF licenses this file to You under the Apache License, Version 2.0
 
17
 * (the "License"); you may not use this file except in compliance with
 
18
 * the License.  You may obtain a copy of the License at
 
19
 *
 
20
 *     http://www.apache.org/licenses/LICENSE-2.0
 
21
 *
 
22
 * Unless required by applicable law or agreed to in writing, software
 
23
 * distributed under the License is distributed on an "AS IS" BASIS,
 
24
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
25
 * See the License for the specific language governing permissions and
 
26
 * limitations under the License.
 
27
 */
 
28
 
 
29
/**
 
30
 * Some definitions for the Simple Sample.
 
31
 * 
 
32
 * @lucene.experimental
 
33
 */
 
34
public class SimpleUtils {
 
35
 
 
36
  /** 
 
37
   * Documents text field.
 
38
   */
 
39
  public static final String TEXT = "text"; 
 
40
 
 
41
  /** 
 
42
   * Documents title field.
 
43
   */
 
44
  public static final String TITLE = "title";
 
45
 
 
46
  /** 
 
47
   * sample documents text (for the text field).
 
48
   */
 
49
  public static String[] docTexts = {
 
50
    "the white car is the one I want.",
 
51
    "the white dog does not belong to anyone.",
 
52
  };
 
53
 
 
54
  /** 
 
55
   * sample documents titles (for the title field).
 
56
   */
 
57
  public static String[] docTitles = {
 
58
    "white car",
 
59
    "white dog",
 
60
  };
 
61
 
 
62
  /**
 
63
   * Categories: categories[D][N] == category-path no. N for document no. D.
 
64
   */
 
65
  public static CategoryPath[][] categories = {
 
66
    { new CategoryPath("root","a","f1"), new CategoryPath("root","a","f2") },
 
67
    { new CategoryPath("root","a","f1"), new CategoryPath("root","a","f3") },
 
68
  };
 
69
 
 
70
  /**
 
71
   * Analyzer used in the simple sample.
 
72
   */
 
73
  public static final Analyzer analyzer = new WhitespaceAnalyzer(ExampleUtils.EXAMPLE_VER);
 
74
 
 
75
  /**
 
76
   * Utility method: List of category paths out of an array of them...
 
77
   * @param categoryPaths input array of category paths.
 
78
   */
 
79
  public static List<CategoryPath> categoryPathArrayToList (CategoryPath...categoryPaths) {
 
80
    ArrayList<CategoryPath> res = new ArrayList<CategoryPath>();
 
81
    for (CategoryPath categoryPath : categoryPaths) {
 
82
      res.add(categoryPath);
 
83
    }
 
84
    return res;
 
85
  }
 
86
 
 
87
}