On 3/3/06, Grant Ingersoll <[EMAIL PROTECTED]> wrote:
> We use Term Vectors quite a bit, in fact, I was thinking of having a go at a 
> patch (so if you want to point me at where to begin)...

The schema should already parse and accept the following attributes on
either a fieldtype or field definition: "termVectors",
"termPositions", "termOffsets"  (these names are in FieldProperties).

SchemaField represents the <field> definitions in the schema.
FieldType represents the <fieldtype> definitions in the schema.

DocumentBuilder is used to build Lucene Documents, using
SchemaField.createField() to create the Field, which delegates to
FieldType.createField().

FieldType:  public Field createField(SchemaField field, String
externalVal, float boost) {
    String val = toInternal(externalVal);
    if (val==null) return null;
    Field f =  new Field(field.getName(), val, field.stored(),
field.indexed(), isTokenized());
    f.setOmitNorms(field.omitNorms());
    f.setBoost(boost);
    return f;
  }

SchemaField already has
public boolean storeTermVector() { return (properties & STORE_TERMVECTORS)!=0; }
public boolean storeTermPositions() { return (properties &
STORE_TERMPOSITIONS)!=0; }
public boolean storeTermOffsets() { return (properties &
STORE_TERMOFFSETS)!=0; }

So it's just a matter of setting the right properties on the Lucene
Field in FieldType.createField().

The harder part is figuring out what to do with TermVectors once they
are stored however... Right now, they won't be returned in the XML
response, you one would need to create a custom query handler to use
them.

> Other than that, I haven't delved into as deeply as I would like to at this 
> point yet, but that is coming soon.

Super!

-Yonik

Reply via email to