Package org.apache.cocoon.components.search.fieldmodel

Examples of org.apache.cocoon.components.search.fieldmodel.FieldDefinition


     * @param value
     *            String value
     */
    public Field createField(String fieldname, String value)
            throws IndexException {
        FieldDefinition f = structure.getFieldDef(fieldname);
        if (f == null) {
            throw new IndexException("Field with the name: " + fieldname
                    + " doesn't exist");
        }
        return f.createLField(value);
    }
View Full Code Here


                        .getChildren(FIELD_ELEMENT);

                IndexStructure docdecl = new IndexStructure();
                for (int j = 0; j < fields.length; j++) {

                    FieldDefinition fielddecl;

                    // field id attribute
                    String id_field = fields[j].getAttribute(ID_ATTRIBUTE);

                    // field type attribute
                    String typeS = fields[j].getAttribute(TYPE_ATTRIBUTE, "");
                    int type = FieldDefinition.stringTotype(typeS);
                    try {
                        fielddecl = FieldDefinition.create(id_field, type);
                    } catch (IllegalArgumentException e) {
                        throw new ConfigurationException("field " + id_field + " type " + typeS, e);
                    }

                    // field store attribute
                    boolean store;
                    if (fielddecl.getType() == FieldDefinition.TEXT) {
                        store = fields[j].getAttributeAsBoolean(STORE_ATTRIBUTE, false);
                    } else {
                        store = fields[j].getAttributeAsBoolean(STORE_ATTRIBUTE, true);
                    }
                    fielddecl.setStore(store);

                    // field dateformat attribute
                    if (fielddecl.getType() == FieldDefinition.DATE) {
                        String dateformat_field = fields[j].getAttribute(DATEFORMAT_ATTRIBUTE);
                        ((DateFieldDefinition) fielddecl).setDateFormat(new SimpleDateFormat(dateformat_field));
                    }

                    this.getLogger().debug("field added: " + fielddecl);
View Full Code Here

                IndexStructure docdecl = new IndexStructure();

                addMetaDataFieldDefinitions(registry, docdecl);
               
                FieldDefinition uuidDef = FieldDefinition.create("uuid", FieldDefinition.KEYWORD);
                uuidDef.setStore(true);
                docdecl.addFieldDef(uuidDef);

                FieldDefinition langDef = FieldDefinition.create("language", FieldDefinition.KEYWORD);
                langDef.setStore(true);
                docdecl.addFieldDef(langDef);

                for (int j = 0; j < fields.length; j++) {

                    FieldDefinition fielddecl;

                    // field id attribute
                    String id_field = fields[j].getAttribute(ID_ATTRIBUTE);

                    // field type attribute
                    String typeS = fields[j].getAttribute(TYPE_ATTRIBUTE, "");
                    int type = FieldDefinition.stringTotype(typeS);
                    try {
                        fielddecl = FieldDefinition.create(id_field, type);
                    } catch (IllegalArgumentException e) {
                        throw new ConfigurationException("field " + id_field + " type " + typeS, e);
                    }

                    // field store attribute
                    boolean store;
                    if (fielddecl.getType() == FieldDefinition.TEXT) {
                        store = fields[j].getAttributeAsBoolean(STORE_ATTRIBUTE, false);
                    } else {
                        store = fields[j].getAttributeAsBoolean(STORE_ATTRIBUTE, true);
                    }
                    fielddecl.setStore(store);

                    // field dateformat attribute
                    if (fielddecl.getType() == FieldDefinition.DATE) {
                        String dateformat_field = fields[j].getAttribute(DATEFORMAT_ATTRIBUTE);
                        ((DateFieldDefinition) fielddecl).setDateFormat(new SimpleDateFormat(
                                dateformat_field));
                    }
View Full Code Here

    protected void addMetaDataFieldDefinitions(MetaDataFieldRegistry registry,
            IndexStructure indexStructure) throws MetaDataException {
        String[] fieldNames = registry.getFieldNames();
        for (int i = 0; i < fieldNames.length; i++) {
            FieldDefinition fieldDef = FieldDefinition.create(fieldNames[i], FieldDefinition.TEXT);
            fieldDef.setStore(false);
            indexStructure.addFieldDef(fieldDef);
        }
    }
View Full Code Here

     * @param value
     *            String value
     */
    public Field createField(String fieldname, String value)
            throws IndexException {
        FieldDefinition f = structure.getFieldDef(fieldname);
        if (f == null) {
            throw new IndexException("Field with the name: " + fieldname
                    + " doesn't exist");
        }
        return f.createLField(value);
    }
View Full Code Here

    public IndexStructure() {
        fielddefs = new HashMap();

        // A index has always an UID field
        FieldDefinition fielddef = FieldDefinition.create(
                Indexer.DOCUMENT_UID_FIELD, FieldDefinition.KEYWORD);
        fielddef.setStore(true);
        this.addFieldDef(fielddef);

    }
View Full Code Here

    public String toString() {
        StringBuffer result = new StringBuffer("DocumentFactory:");
        Iterator iter = this.fielddefs.values().iterator();
        while (iter.hasNext()) {
            FieldDefinition item = (FieldDefinition) iter.next();
            result.append("\n").append(item.toString());
        }
        return result.toString();
    }
View Full Code Here

TOP

Related Classes of org.apache.cocoon.components.search.fieldmodel.FieldDefinition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.