1 package org.apache.lucene.facet.enhancements;
3 import org.apache.lucene.analysis.TokenStream;
5 import org.apache.lucene.facet.enhancements.CategoryEnhancement;
6 import org.apache.lucene.facet.enhancements.params.EnhancementsIndexingParams;
7 import org.apache.lucene.facet.index.DummyProperty;
8 import org.apache.lucene.facet.index.attributes.CategoryAttribute;
9 import org.apache.lucene.facet.index.attributes.CategoryProperty;
10 import org.apache.lucene.facet.index.streaming.CategoryListTokenizer;
11 import org.apache.lucene.facet.taxonomy.TaxonomyWriter;
14 * Licensed to the Apache Software Foundation (ASF) under one or more
15 * contributor license agreements. See the NOTICE file distributed with
16 * this work for additional information regarding copyright ownership.
17 * The ASF licenses this file to You under the Apache License, Version 2.0
18 * (the "License"); you may not use this file except in compliance with
19 * the License. You may obtain a copy of the License at
21 * http://www.apache.org/licenses/LICENSE-2.0
23 * Unless required by applicable law or agreed to in writing, software
24 * distributed under the License is distributed on an "AS IS" BASIS,
25 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26 * See the License for the specific language governing permissions and
27 * limitations under the License.
30 public class CategoryEnhancementDummy2 implements CategoryEnhancement {
32 public static byte[] CATEGORY_TOKEN_BYTES = new byte[] { 3, 0, 7 };
34 public boolean generatesCategoryList() {
38 public String getCategoryListTermText() {
42 public CategoryListTokenizer getCategoryListTokenizer(
43 TokenStream tokenizer, EnhancementsIndexingParams indexingParams,
44 TaxonomyWriter taxonomyWriter) {
48 public byte[] getCategoryTokenBytes(CategoryAttribute categoryAttribute) {
49 return CATEGORY_TOKEN_BYTES;
52 public Object extractCategoryTokenData(byte[] buffer, int offset, int length) {
53 if (length != CATEGORY_TOKEN_BYTES.length) {
54 throw new IllegalArgumentException("unexpected data length "
57 byte[] ret = new byte[length];
58 System.arraycopy(buffer, offset, ret, 0, length);
62 public Class<? extends CategoryProperty> getRetainableProperty() {
63 return DummyProperty.class;
67 public boolean equals(Object o) {
68 if (o instanceof CategoryEnhancementDummy2) {
75 public int hashCode() {
76 return super.hashCode();