Package org.apache.cocoon.components.search

Examples of org.apache.cocoon.components.search.IndexStructure


                }

                Configuration[] fields = confs[i].getChild(STRUCTURE_ELEMENT)
                        .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);
                    docdecl.addFieldDef(fielddecl);
                }

                Index index = new Index();
                index.setID(id);
                index.setIndexer(indexerRole);
View Full Code Here


                String directory = confs[i].getAttribute(INDEX_DIRECTORY_ATTRIBUTE);

                Configuration[] fields = confs[i].getChild(STRUCTURE_ELEMENT).getChildren(
                        FIELD_ELEMENT);

                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));
                    }

                    this.getLogger().debug("field added: " + fielddecl);
                    docdecl.addFieldDef(fielddecl);
                }

                Index index = new Index();
                index.setID(id);
                index.setIndexer(indexerRole);
View Full Code Here

TOP

Related Classes of org.apache.cocoon.components.search.IndexStructure

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.