001/* 002 * Copyright (c) 2006-2014 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the Eclipse Public License v1.0 006 * which accompanies this distribution, and is available at 007 * http://www.eclipse.org/legal/epl-v10.html 008 * 009 * Contributors: 010 * Florent Guillaume 011 */ 012 013package org.nuxeo.ecm.core.storage; 014 015import java.util.HashMap; 016import java.util.HashSet; 017import java.util.LinkedHashSet; 018import java.util.Map; 019import java.util.Set; 020 021/** 022 * Info about the fulltext configuration. 023 */ 024public class FulltextConfiguration { 025 026 public static final String ROOT_TYPE = "Root"; 027 028 public static final String PROP_TYPE_STRING = "string"; 029 030 public static final String PROP_TYPE_BLOB = "blob"; 031 032 /** All index names. */ 033 public final Set<String> indexNames = new LinkedHashSet<String>(); 034 035 /** Indexes holding exactly one field. */ 036 public final Map<String, String> fieldToIndexName = new HashMap<String, String>(); 037 038 /** Map of index to analyzer (may be null). */ 039 public final Map<String, String> indexAnalyzer = new HashMap<String, String>(); 040 041 /** Map of index to catalog (may be null). */ 042 public final Map<String, String> indexCatalog = new HashMap<String, String>(); 043 044 /** Indexes containing all simple properties. */ 045 public final Set<String> indexesAllSimple = new HashSet<String>(); 046 047 /** Indexes containing all binaries properties. */ 048 public final Set<String> indexesAllBinary = new HashSet<String>(); 049 050 /** Indexes for each specific simple property path. */ 051 public final Map<String, Set<String>> indexesByPropPathSimple = new HashMap<String, Set<String>>(); 052 053 /** Indexes for each specific binary property path. */ 054 public final Map<String, Set<String>> indexesByPropPathBinary = new HashMap<String, Set<String>>(); 055 056 /** Indexes for each specific simple property path excluded. */ 057 public final Map<String, Set<String>> indexesByPropPathExcludedSimple = new HashMap<String, Set<String>>(); 058 059 /** Indexes for each specific binary property path excluded. */ 060 public final Map<String, Set<String>> indexesByPropPathExcludedBinary = new HashMap<String, Set<String>>(); 061 062 // inverse of above maps 063 public final Map<String, Set<String>> propPathsByIndexSimple = new HashMap<String, Set<String>>(); 064 065 public final Map<String, Set<String>> propPathsByIndexBinary = new HashMap<String, Set<String>>(); 066 067 public final Map<String, Set<String>> propPathsExcludedByIndexSimple = new HashMap<String, Set<String>>(); 068 069 public final Map<String, Set<String>> propPathsExcludedByIndexBinary = new HashMap<String, Set<String>>(); 070 071 public final Set<String> excludedTypes = new HashSet<String>(); 072 073 public final Set<String> includedTypes = new HashSet<String>(); 074 075 public FulltextConfiguration() { 076 } 077 078 public boolean isFulltextIndexable(String typeName) { 079 if (ROOT_TYPE.equals(typeName)) { 080 return false; 081 } 082 if (includedTypes.contains(typeName) || (includedTypes.isEmpty() && !excludedTypes.contains(typeName))) { 083 return true; 084 } 085 return false; 086 } 087 088}