mirror of https://github.com/apache/lucene.git
SOLR-739: Add support for OmitTf
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@746868 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e3a99f1cad
commit
6ae1c862f4
|
@ -158,6 +158,7 @@ New Features
|
|||
|
||||
27. SOLR-1026: Add protected words support to SnowballPorterFilterFactory (ehatcher)
|
||||
|
||||
28. SOLR-739: Add support for OmitTf (Mark Miller via yonik)
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
|
|
|
@ -32,13 +32,14 @@
|
|||
be used for benchmarking.
|
||||
-->
|
||||
|
||||
<schema name="example" version="1.1">
|
||||
<schema name="example" version="1.2">
|
||||
<!-- attribute "name" is the name of this schema and is only used for display purposes.
|
||||
Applications should change this to reflect the nature of the search collection.
|
||||
version="1.1" is Solr's version number for the schema syntax and semantics. It should
|
||||
version="1.2" is Solr's version number for the schema syntax and semantics. It should
|
||||
not normally be changed by applications.
|
||||
1.0: multiValued attribute did not exist, all fields are multiValued by nature
|
||||
1.1: multiValued attribute introduced, false by default -->
|
||||
1.1: multiValued attribute introduced, false by default
|
||||
1.2: omitTf attribute introduced, true by default -->
|
||||
|
||||
<types>
|
||||
<!-- field type definitions. The "name" attribute is
|
||||
|
|
|
@ -30,6 +30,7 @@ public enum FieldFlag {
|
|||
TERM_VECTOR_OFFSET('o', "Store Offset With TermVector"),
|
||||
TERM_VECTOR_POSITION('p', "Store Position With TermVector"),
|
||||
OMIT_NORMS('O', "Omit Norms"),
|
||||
OMIT_TF('F', "Omit Tf"),
|
||||
LAZY('L', "Lazy"),
|
||||
BINARY('B', "Binary"),
|
||||
COMPRESSED('C', "Compressed"),
|
||||
|
|
|
@ -198,6 +198,7 @@ public class LukeRequestHandler extends RequestHandlerBase
|
|||
flags.append( (f != null && f.storeTermOffsets() ) ? FieldFlag.TERM_VECTOR_OFFSET.getAbbreviation() : '-' );
|
||||
flags.append( (f != null && f.storeTermPositions() ) ? FieldFlag.TERM_VECTOR_POSITION.getAbbreviation() : '-' );
|
||||
flags.append( (f != null && f.omitNorms()) ? FieldFlag.OMIT_NORMS.getAbbreviation() : '-' );
|
||||
flags.append( (f != null && f.omitTf()) ? FieldFlag.OMIT_TF.getAbbreviation() : '-' );
|
||||
flags.append( (lazy) ? FieldFlag.LAZY.getAbbreviation() : '-' );
|
||||
flags.append( (binary) ? FieldFlag.BINARY.getAbbreviation() : '-' );
|
||||
flags.append( (f != null && f.isCompressed()) ? FieldFlag.COMPRESSED.getAbbreviation() : '-' );
|
||||
|
|
|
@ -35,19 +35,21 @@ abstract class FieldProperties {
|
|||
final static int BINARY = 0x00000008;
|
||||
final static int COMPRESSED = 0x00000010;
|
||||
final static int OMIT_NORMS = 0x00000020;
|
||||
final static int STORE_TERMVECTORS = 0x00000040;
|
||||
final static int STORE_TERMPOSITIONS = 0x00000080;
|
||||
final static int STORE_TERMOFFSETS = 0x00000100;
|
||||
final static int OMIT_TF = 0x00000040;
|
||||
final static int STORE_TERMVECTORS = 0x00000080;
|
||||
final static int STORE_TERMPOSITIONS = 0x00000100;
|
||||
final static int STORE_TERMOFFSETS = 0x00000200;
|
||||
|
||||
final static int MULTIVALUED = 0x00000200;
|
||||
final static int SORT_MISSING_FIRST = 0x00000400;
|
||||
final static int SORT_MISSING_LAST = 0x00000800;
|
||||
|
||||
final static int REQUIRED = 0x00001000;
|
||||
final static int MULTIVALUED = 0x00000400;
|
||||
final static int SORT_MISSING_FIRST = 0x00000800;
|
||||
final static int SORT_MISSING_LAST = 0x00001000;
|
||||
|
||||
final static int REQUIRED = 0x00002000;
|
||||
|
||||
static final String[] propertyNames = {
|
||||
"indexed", "tokenized", "stored",
|
||||
"binary", "compressed", "omitNorms",
|
||||
"binary", "compressed", "omitNorms", "omitTf",
|
||||
"termVectors", "termPositions", "termOffsets",
|
||||
"multiValued",
|
||||
"sortMissingFirst","sortMissingLast","required"
|
||||
|
|
|
@ -86,9 +86,10 @@ public abstract class FieldType extends FieldProperties {
|
|||
|
||||
// Handle additional arguments...
|
||||
void setArgs(IndexSchema schema, Map<String,String> args) {
|
||||
// default to STORED and INDEXED, and MULTIVALUED depending on schema version
|
||||
// default to STORED, INDEXED, OMIT_TF and MULTIVALUED depending on schema version
|
||||
properties = (STORED | INDEXED);
|
||||
if (schema.getVersion()< 1.1f) properties |= MULTIVALUED;
|
||||
if (schema.getVersion()> 1.1f) properties |= OMIT_TF;
|
||||
|
||||
this.args=args;
|
||||
Map<String,String> initArgs = new HashMap<String,String>(args);
|
||||
|
@ -199,6 +200,7 @@ public abstract class FieldType extends FieldProperties {
|
|||
getFieldIndex(field, val),
|
||||
getFieldTermVec(field, val));
|
||||
f.setOmitNorms(field.omitNorms());
|
||||
f.setOmitTf(field.omitTf());
|
||||
f.setBoost(boost);
|
||||
return f;
|
||||
}
|
||||
|
|
|
@ -79,6 +79,7 @@ public final class SchemaField extends FieldProperties {
|
|||
public boolean storeTermPositions() { return (properties & STORE_TERMPOSITIONS)!=0; }
|
||||
public boolean storeTermOffsets() { return (properties & STORE_TERMOFFSETS)!=0; }
|
||||
public boolean omitNorms() { return (properties & OMIT_NORMS)!=0; }
|
||||
public boolean omitTf() { return (properties & OMIT_TF)!=0; }
|
||||
public boolean multiValued() { return (properties & MULTIVALUED)!=0; }
|
||||
public boolean sortMissingFirst() { return (properties & SORT_MISSING_FIRST)!=0; }
|
||||
public boolean sortMissingLast() { return (properties & SORT_MISSING_LAST)!=0; }
|
||||
|
@ -136,7 +137,7 @@ public final class SchemaField extends FieldProperties {
|
|||
}
|
||||
|
||||
if (on(falseProps,INDEXED)) {
|
||||
int pp = (INDEXED | OMIT_NORMS
|
||||
int pp = (INDEXED | OMIT_NORMS | OMIT_TF
|
||||
| STORE_TERMVECTORS | STORE_TERMPOSITIONS | STORE_TERMOFFSETS
|
||||
| SORT_MISSING_FIRST | SORT_MISSING_LAST);
|
||||
if (on(pp,trueProps)) {
|
||||
|
|
|
@ -32,6 +32,8 @@ import java.io.IOException;
|
|||
public class TextField extends CompressableField {
|
||||
protected void init(IndexSchema schema, Map<String,String> args) {
|
||||
properties |= TOKENIZED;
|
||||
if (schema.getVersion()> 1.1f) properties &= ~OMIT_TF;
|
||||
|
||||
super.init(schema, args);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue