1 package org.apache.lucene.facet.example.multiCL;
5 import org.apache.lucene.store.Directory;
6 import org.apache.lucene.store.RAMDirectory;
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;
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
20 * http://www.apache.org/licenses/LICENSE-2.0
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.
30 * @lucene.experimental
32 public class MultiCLMain {
35 * Driver for the multi sample.
38 * on error (no detailed exception handling here for sample
41 public static void main(String[] args) throws Exception {
42 new MultiCLMain().runSample();
43 ExampleUtils.log("DONE");
46 public ExampleResult runSample() throws Exception {
48 // create Directories for the search index and for the taxonomy index
49 Directory indexDir = new RAMDirectory();
50 Directory taxoDir = new RAMDirectory();
52 // index the sample documents
53 ExampleUtils.log("index the sample documents...");
54 MultiCLIndexer.index(indexDir, taxoDir);
56 ExampleUtils.log("search the sample documents...");
57 List<FacetResult> facetRes = MultiCLSearcher.searchWithFacets(indexDir,
58 taxoDir, MultiCLIndexer.MULTI_IPARAMS);
60 ExampleResult res = new ExampleResult();
61 res.setFacetResults(facetRes);