// Path: src/main/java/de/danielbasedow/prospecter/core/index/FullTextIndex.java
// public class FullTextIndex extends AbstractFieldIndex {
//     private static final Logger LOGGER = LoggerFactory.getLogger(FullTextIndex.class);
// 
//     protected final TIntObjectHashMap<TLongList> index = new TIntObjectHashMap<TLongList>();
// 
//     private final Analyzer analyzer;
// 
//     public FullTextIndex(String name, Analyzer analyzer) {
//         super(name);
//         this.analyzer = analyzer;
//     }
// 
//     @Override
//     public void addPosting(Token token, Long posting) {
//         TLongList postingList;
//         if (index.containsKey((Integer) token.getToken())) {
//             postingList = index.get((Integer) token.getToken());
//         } else {
//             postingList = new TLongArrayList();
//             index.put((Integer) token.getToken(), postingList);
//         }
//         postingList.add(posting);
//     }
// 
//     @Override
//     public void removePosting(Token token, Long posting) {
//         TLongList postingList = index.get((Integer) token.getToken());
//         if (postingList != null && postingList.contains(posting)) {
//             LOGGER.debug("removing posting: " + String.valueOf(posting));
//             postingList.remove(posting);
//         }
//     }
// 
//     @Override
//     public FieldType getFieldType() {
//         return FieldType.FULL_TEXT;
//     }
// 
//     public TLongList getQueryPostingsForTermId(Token token) {
//         Integer t = (Integer) token.getToken();
//         if (index.containsKey(t)) {
//             return index.get(t);
//         }
//         return null;
//     }
// 
//     @Override
//     public void match(Field field, Matcher matcher) {
//         for (Token token : field.getTokens()) {
//             Integer t = (Integer) token.getToken();
//             TLongList additionalPostings = index.get(t);
//             if (additionalPostings != null) {
//                 matcher.addHits(additionalPostings);
//             }
//         }
//     }
// 
//     public Analyzer getAnalyzer() {
//         return analyzer;
//     }
// 
//     public void trim() {
//         for (Object list : index.values()) {
//             if (list instanceof ArrayList) {
//                 ((ArrayList) list).trimToSize();
//             }
//         }
//     }
// }
// 
// Path: src/main/java/de/danielbasedow/prospecter/core/index/IntegerIndex.java
// public class IntegerIndex extends AbstractRangeFieldIndex<Integer> {
// 
//     public IntegerIndex(String name) {
//         super(name);
//     }
// 
//     @Override
//     public FieldType getFieldType() {
//         return FieldType.INTEGER;
//     }
// 
// 
// }


import de.danielbasedow.prospecter.core.index.FullTextIndex;
import de.danielbasedow.prospecter.core.index.IntegerIndex;
import junit.framework.TestCase;
package de.danielbasedow.prospecter.core.schema;


public class SchemaBuilderJSONTest extends TestCase {
    public void testValidJSON() {
        String json = "{" +
                "    \"fields\": {" +
                "        \"textField\": {" +
                "            \"type\": \"FullText\"," +
                "            \"options\": {" +
                "                \"analyzer\": \"de.danielbasedow.prospecter.core.analysis.LuceneStandardAnalyzer\"" +
                "            }" +
                "        }," +
                "        \"price\": {" +
                "            \"type\": \"Integer\"" +
                "        }" +
                "    }" +
                "}";
        Schema schema;
        try {
            SchemaBuilder builder = new SchemaBuilderJSON(json);
            schema = builder.getSchema();
            assertEquals(2, schema.getFieldCount());
// Path: src/main/java/de/danielbasedow/prospecter/core/index/FullTextIndex.java
// public class FullTextIndex extends AbstractFieldIndex {
//     private static final Logger LOGGER = LoggerFactory.getLogger(FullTextIndex.class);
// 
//     protected final TIntObjectHashMap<TLongList> index = new TIntObjectHashMap<TLongList>();
// 
//     private final Analyzer analyzer;
// 
//     public FullTextIndex(String name, Analyzer analyzer) {
//         super(name);
//         this.analyzer = analyzer;
//     }
// 
//     @Override
//     public void addPosting(Token token, Long posting) {
//         TLongList postingList;
//         if (index.containsKey((Integer) token.getToken())) {
//             postingList = index.get((Integer) token.getToken());
//         } else {
//             postingList = new TLongArrayList();
//             index.put((Integer) token.getToken(), postingList);
//         }
//         postingList.add(posting);
//     }
// 
//     @Override
//     public void removePosting(Token token, Long posting) {
//         TLongList postingList = index.get((Integer) token.getToken());
//         if (postingList != null && postingList.contains(posting)) {
//             LOGGER.debug("removing posting: " + String.valueOf(posting));
//             postingList.remove(posting);
//         }
//     }
// 
//     @Override
//     public FieldType getFieldType() {
//         return FieldType.FULL_TEXT;
//     }
// 
//     public TLongList getQueryPostingsForTermId(Token token) {
//         Integer t = (Integer) token.getToken();
//         if (index.containsKey(t)) {
//             return index.get(t);
//         }
//         return null;
//     }
// 
//     @Override
//     public void match(Field field, Matcher matcher) {
//         for (Token token : field.getTokens()) {
//             Integer t = (Integer) token.getToken();
//             TLongList additionalPostings = index.get(t);
//             if (additionalPostings != null) {
//                 matcher.addHits(additionalPostings);
//             }
//         }
//     }
// 
//     public Analyzer getAnalyzer() {
//         return analyzer;
//     }
// 
//     public void trim() {
//         for (Object list : index.values()) {
//             if (list instanceof ArrayList) {
//                 ((ArrayList) list).trimToSize();
//             }
//         }
//     }
// }
// 
// Path: src/main/java/de/danielbasedow/prospecter/core/index/IntegerIndex.java
// public class IntegerIndex extends AbstractRangeFieldIndex<Integer> {
// 
//     public IntegerIndex(String name) {
//         super(name);
//     }
// 
//     @Override
//     public FieldType getFieldType() {
//         return FieldType.INTEGER;
//     }
// 
// 
// }


// Path: src/test/java/de/danielbasedow/prospecter/core/schema/SchemaBuilderJSONTest.java
import de.danielbasedow.prospecter.core.index.FullTextIndex;
import de.danielbasedow.prospecter.core.index.IntegerIndex;
import junit.framework.TestCase;

package de.danielbasedow.prospecter.core.schema;


public class SchemaBuilderJSONTest extends TestCase {
    public void testValidJSON() {
        String json = "{" +
                "    \"fields\": {" +
                "        \"textField\": {" +
                "            \"type\": \"FullText\"," +
                "            \"options\": {" +
                "                \"analyzer\": \"de.danielbasedow.prospecter.core.analysis.LuceneStandardAnalyzer\"" +
                "            }" +
                "        }," +
                "        \"price\": {" +
                "            \"type\": \"Integer\"" +
                "        }" +
                "    }" +
                "}";
        Schema schema;
        try {
            SchemaBuilder builder = new SchemaBuilderJSON(json);
            schema = builder.getSchema();
            assertEquals(2, schema.getFieldCount());
            assertTrue(schema.getFieldIndex("price") instanceof IntegerIndex);