View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.index;
20  
21  import java.io.Serializable;
22  import java.util.regex.Pattern;
23  
24  import org.apache.lucene.document.StoredField;
25  
26  /**
27   * Pulling out ArtifactInfo, clearing up. TBD. This gonna be extensible "map-like" class with fields.
28   *
29   * @author cstamas
30   */
31  public class ArtifactInfoRecord implements Serializable {
32      private static final long serialVersionUID = -4577081994768263824L;
33  
34      /** Field separator */
35      public static final String FS = "|";
36  
37      public static final Pattern FS_PATTERN = Pattern.compile(Pattern.quote(FS));
38  
39      /** Non available value */
40      public static final String NA = "NA";
41  
42      // ----------
43      // V3 changes
44      // TODO: use getters instead of public fields
45      // ----------
46      // Listing all the fields that ArtifactInfo has on LuceneIndex
47  
48      /**
49       * Unique groupId, artifactId, version, classifier, extension (or packaging). Stored, indexed untokenized
50       */
51      public static final IndexerField FLD_UINFO = new IndexerField(
52              NEXUS.UINFO,
53              IndexerFieldVersion.V1,
54              "u",
55              "Artifact UINFO (as keyword, stored)",
56              IndexerField.KEYWORD_STORED);
57  
58      /**
59       * Del: contains UINFO to mark record as deleted (needed for incremental updates!). The original document IS
60       * removed, but this marker stays on index to note that fact.
61       */
62      public static final IndexerField FLD_DELETED = new IndexerField(
63              NEXUS.DELETED,
64              IndexerFieldVersion.V1,
65              "del",
66              "Deleted field, will contain UINFO if document is deleted from index (not indexed, stored)",
67              StoredField.TYPE);
68  }