|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Fieldable | Line # 26 | 0 | 0 | - |
-1.0
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| No Tests | |||
| 1 | package org.apache.lucene.document; | |
| 2 | ||
| 3 | /** | |
| 4 | * Copyright 2004 The Apache Software Foundation | |
| 5 | * | |
| 6 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 7 | * you may not use this file except in compliance with the License. | |
| 8 | * 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, software | |
| 13 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 15 | * See the License for the specific language governing permissions and | |
| 16 | * limitations under the License. | |
| 17 | */ | |
| 18 | ||
| 19 | import java.io.Reader; | |
| 20 | import java.io.Serializable; | |
| 21 | ||
| 22 | /** | |
| 23 | * Synonymous with {@link Field}. | |
| 24 | * | |
| 25 | **/ | |
| 26 | public interface Fieldable extends Serializable { | |
| 27 | /** Sets the boost factor hits on this field. This value will be | |
| 28 | * multiplied into the score of all hits on this this field of this | |
| 29 | * document. | |
| 30 | * | |
| 31 | * <p>The boost is multiplied by {@link org.apache.lucene.document.Document#getBoost()} of the document | |
| 32 | * containing this field. If a document has multiple fields with the same | |
| 33 | * name, all such values are multiplied together. This product is then | |
| 34 | * multipled by the value {@link org.apache.lucene.search.Similarity#lengthNorm(String,int)}, and | |
| 35 | * rounded by {@link org.apache.lucene.search.Similarity#encodeNorm(float)} before it is stored in the | |
| 36 | * index. One should attempt to ensure that this product does not overflow | |
| 37 | * the range of that encoding. | |
| 38 | * | |
| 39 | * @see org.apache.lucene.document.Document#setBoost(float) | |
| 40 | * @see org.apache.lucene.search.Similarity#lengthNorm(String, int) | |
| 41 | * @see org.apache.lucene.search.Similarity#encodeNorm(float) | |
| 42 | */ | |
| 43 | void setBoost(float boost); | |
| 44 | ||
| 45 | /** Returns the boost factor for hits for this field. | |
| 46 | * | |
| 47 | * <p>The default value is 1.0. | |
| 48 | * | |
| 49 | * <p>Note: this value is not stored directly with the document in the index. | |
| 50 | * Documents returned from {@link org.apache.lucene.index.IndexReader#document(int)} and | |
| 51 | * {@link org.apache.lucene.search.Hits#doc(int)} may thus not have the same value present as when | |
| 52 | * this field was indexed. | |
| 53 | * | |
| 54 | * @see #setBoost(float) | |
| 55 | */ | |
| 56 | float getBoost(); | |
| 57 | ||
| 58 | /** Returns the name of the field as an interned string. | |
| 59 | * For example "date", "title", "body", ... | |
| 60 | */ | |
| 61 | String name(); | |
| 62 | ||
| 63 | /** The value of the field as a String, or null. If null, the Reader value | |
| 64 | * or binary value is used. Exactly one of stringValue(), readerValue(), and | |
| 65 | * binaryValue() must be set. */ | |
| 66 | String stringValue(); | |
| 67 | ||
| 68 | /** The value of the field as a Reader, or null. If null, the String value | |
| 69 | * or binary value is used. Exactly one of stringValue(), readerValue(), | |
| 70 | * and binaryValue() must be set. */ | |
| 71 | Reader readerValue(); | |
| 72 | ||
| 73 | /** The value of the field in Binary, or null. If null, the Reader or | |
| 74 | * String value is used. Exactly one of stringValue(), readerValue() and | |
| 75 | * binaryValue() must be set. */ | |
| 76 | byte[] binaryValue(); | |
| 77 | ||
| 78 | /** True iff the value of the field is to be stored in the index for return | |
| 79 | with search hits. It is an error for this to be true if a field is | |
| 80 | Reader-valued. */ | |
| 81 | boolean isStored(); | |
| 82 | ||
| 83 | /** True iff the value of the field is to be indexed, so that it may be | |
| 84 | searched on. */ | |
| 85 | boolean isIndexed(); | |
| 86 | ||
| 87 | /** True iff the value of the field should be tokenized as text prior to | |
| 88 | indexing. Un-tokenized fields are indexed as a single word and may not be | |
| 89 | Reader-valued. */ | |
| 90 | boolean isTokenized(); | |
| 91 | ||
| 92 | /** True if the value of the field is stored and compressed within the index */ | |
| 93 | boolean isCompressed(); | |
| 94 | ||
| 95 | /** True iff the term or terms used to index this field are stored as a term | |
| 96 | * vector, available from {@link org.apache.lucene.index.IndexReader#getTermFreqVector(int,String)}. | |
| 97 | * These methods do not provide access to the original content of the field, | |
| 98 | * only to terms used to index it. If the original content must be | |
| 99 | * preserved, use the <code>stored</code> attribute instead. | |
| 100 | * | |
| 101 | * @see org.apache.lucene.index.IndexReader#getTermFreqVector(int, String) | |
| 102 | */ | |
| 103 | boolean isTermVectorStored(); | |
| 104 | ||
| 105 | /** | |
| 106 | * True iff terms are stored as term vector together with their offsets | |
| 107 | * (start and end positon in source text). | |
| 108 | */ | |
| 109 | boolean isStoreOffsetWithTermVector(); | |
| 110 | ||
| 111 | /** | |
| 112 | * True iff terms are stored as term vector together with their token positions. | |
| 113 | */ | |
| 114 | boolean isStorePositionWithTermVector(); | |
| 115 | ||
| 116 | /** True iff the value of the filed is stored as binary */ | |
| 117 | boolean isBinary(); | |
| 118 | ||
| 119 | /** True if norms are omitted for this indexed field */ | |
| 120 | boolean getOmitNorms(); | |
| 121 | ||
| 122 | /** Expert: | |
| 123 | * | |
| 124 | * If set, omit normalization factors associated with this indexed field. | |
| 125 | * This effectively disables indexing boosts and length normalization for this field. | |
| 126 | */ | |
| 127 | void setOmitNorms(boolean omitNorms); | |
| 128 | ||
| 129 | /** | |
| 130 | * Indicates whether a Field is Lazy or not. The semantics of Lazy loading are such that if a Field is lazily loaded, retrieving | |
| 131 | * it's values via {@link #stringValue()} or {@link #binaryValue()} is only valid as long as the {@link org.apache.lucene.index.IndexReader} that | |
| 132 | * retrieved the {@link Document} is still open. | |
| 133 | * | |
| 134 | * @return true if this field can be loaded lazily | |
| 135 | */ | |
| 136 | boolean isLazy(); | |
| 137 | } | |
|
||||||||||