add --shared
[pylucene.git] / lucene-java-3.4.0 / lucene / contrib / facet / src / examples / org / apache / lucene / facet / example / multiCL / MultiCLMain.java
1 package org.apache.lucene.facet.example.multiCL;
2
3 import java.util.List;
4
5 import org.apache.lucene.store.Directory;
6 import org.apache.lucene.store.RAMDirectory;
7
8 import org.apache.lucene.facet.example.ExampleResult;
9 import org.apache.lucene.facet.example.ExampleUtils;
10 import org.apache.lucene.facet.search.results.FacetResult;
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  * @lucene.experimental
31  */
32 public class MultiCLMain {
33
34   /**
35    * Driver for the multi sample.
36    * 
37    * @throws Exception
38    *             on error (no detailed exception handling here for sample
39    *             simplicity
40    */
41   public static void main(String[] args) throws Exception {
42     new MultiCLMain().runSample();
43     ExampleUtils.log("DONE");
44   }
45
46   public ExampleResult runSample() throws Exception {
47
48     // create Directories for the search index and for the taxonomy index
49     Directory indexDir = new RAMDirectory();
50     Directory taxoDir = new RAMDirectory();
51
52     // index the sample documents
53     ExampleUtils.log("index the sample documents...");
54     MultiCLIndexer.index(indexDir, taxoDir);
55
56     ExampleUtils.log("search the sample documents...");
57     List<FacetResult> facetRes = MultiCLSearcher.searchWithFacets(indexDir,
58         taxoDir, MultiCLIndexer.MULTI_IPARAMS);
59
60     ExampleResult res = new ExampleResult();
61     res.setFacetResults(facetRes);
62     return res;
63   }
64
65 }