Package org.lilyproject.indexer.model.indexerconf

Examples of org.lilyproject.indexer.model.indexerconf.LilyIndexerConf


                "xmlns:ns1='ns1' xmlns:ns='ns'",
                Lists.newArrayList("recordType='ns1:typeA' variant='prop1=val1' field='ns:int=10' vtags='vtag1'"),
                Collections.<String>emptyList()
        );

        LilyIndexerConf idxConf = LilyIndexerConfBuilder.build(new ByteArrayInputStream(conf.getBytes()), repository);

        Record record1 = repository.getDefaultTable().recordBuilder()
                .id("record", ImmutableMap.of("prop1", "val1"))
                .recordType(new QName("ns1", "typeA"))
                .field(new QName("ns", "int"), new Integer(10))
                .build();

        assertNotNull(idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, record1));

        Record record2 = repository.getDefaultTable().recordBuilder()
                .id("record", ImmutableMap.of("prop1", "val1"))
                .recordType(new QName("ns1", "typeA"))
                .field(new QName("ns", "int"), new Integer(11))
                .build();

        assertNull(idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, record2));

        Record record3 = repository.getDefaultTable().recordBuilder()
                .id("record", ImmutableMap.of("prop1", "val1"))
                .recordType(new QName("ns1", "typeB"))
                .field(new QName("ns", "int"), new Integer(10))
                .build();

        assertNull(idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, record3));

        Record record4 = repository.getDefaultTable().recordBuilder()
                .id("record", ImmutableMap.of("prop1", "val2"))
                .recordType(new QName("ns1", "typeA"))
                .field(new QName("ns", "int"), new Integer(10))
                .build();

        assertNull(idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, record4));
    }
View Full Code Here


                "xmlns:ns1='ns1' xmlns:ns='ns'",
                Lists.newArrayList("vtags='vtag1'"), /* an include without conditions */
                Collections.<String>emptyList()
        );

        LilyIndexerConf idxConf = LilyIndexerConfBuilder.build(new ByteArrayInputStream(conf.getBytes()), repository);

        // A record of any type with any number of variant properties should match
        Record record1 = repository.getDefaultTable().recordBuilder()
                .id("record", ImmutableMap.of("prop1", "val1"))
                .recordType(new QName("ns1", "typeA"))
                .field(new QName("ns", "int"), new Integer(10))
                .build();

        assertNotNull(idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, record1));
    }
View Full Code Here

                "xmlns:ns1='ns1' xmlns:ns='ns'",
                Lists.newArrayList("vtags='vtag1'"),
                Lists.newArrayList("")
        );

        LilyIndexerConf idxConf = LilyIndexerConfBuilder.build(new ByteArrayInputStream(conf.getBytes()), repository);

        // A record of any type with any number of variant properties should match
        Record record1 = repository.getDefaultTable().recordBuilder()
                .id("record", ImmutableMap.of("prop1", "val1"))
                .recordType(new QName("ns1", "typeA"))
                .field(new QName("ns", "int"), new Integer(10))
                .build();

        assertNull(idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, record1));
    }
View Full Code Here

                        "xmlns:ns1='ns1' xmlns:ns='ns'",
                        Lists.newArrayList("vtags='last' tables='myrecordtable'"),
                        Lists.<String>newArrayList());


        LilyIndexerConf idxConf = LilyIndexerConfBuilder.build(new ByteArrayInputStream(conf.getBytes()), repository);

        Record record = repository.getDefaultTable().recordBuilder().id("record").field(new QName("ns", "int"), new Integer(42)).build();

        assertNotNull(idxConf.getRecordFilter().getIndexCase("myrecordtable", record));
    }
View Full Code Here

    public void testInclude_NoTableMatch() throws IndexerConfException, RepositoryException, InterruptedException {
        String conf = makeIndexerConf("xmlns:ns1='ns1' xmlns:ns='ns'",
                Lists.newArrayList("vtags='last' tables='myrecordtable'"),
                Lists.<String>newArrayList());

        LilyIndexerConf idxConf = LilyIndexerConfBuilder.build(new ByteArrayInputStream(conf.getBytes()), repository);

        Record record = repository.getDefaultTable().recordBuilder().id("record").field(new QName("ns", "int"), new Integer(42)).build();

        assertNull(idxConf.getRecordFilter().getIndexCase("notmyrecordtable", record));
    }
View Full Code Here

    public void testExclude_WithTableMatch() throws IndexerConfException, RepositoryException, InterruptedException {
        String conf = makeIndexerConf("xmlns:ns1='ns1' xmlns:ns='ns'",
                Lists.newArrayList("vtags='last'"),
                Lists.newArrayList("tables='myrecordtable'"));

        LilyIndexerConf idxConf = LilyIndexerConfBuilder.build(new ByteArrayInputStream(conf.getBytes()), repository);

        Record record = repository.getDefaultTable().recordBuilder().id("record").field(new QName("ns", "int"), new Integer(42)).build();

        assertNull(idxConf.getRecordFilter().getIndexCase("myrecordtable", record));
    }
View Full Code Here

    public void testExclude_NoTableMatch() throws RepositoryException, InterruptedException, IndexerConfException {
        String conf = makeIndexerConf("xmlns:ns1='ns1' xmlns:ns='ns'",
                Lists.newArrayList("vtags='last'"),
                Lists.newArrayList("tables='myrecordtable'"));

        LilyIndexerConf idxConf = LilyIndexerConfBuilder.build(new ByteArrayInputStream(conf.getBytes()), repository);

        Record record = repository.getDefaultTable().recordBuilder().id("record").field(new QName("ns", "int"), new Integer(42)).build();

        assertNotNull(idxConf.getRecordFilter().getIndexCase("notmyrecordtable", record));
    }
View Full Code Here

                        "recordType='ns1:typeA' vtags='vtag1'",
                        "recordType='{ns1}typeB' vtags='vtag2'"),
                Collections.<String>emptyList()
        );

        LilyIndexerConf idxConf = LilyIndexerConfBuilder.build(new ByteArrayInputStream(conf.getBytes()), repository);

        Record recordTypeA = newRecordOfType(new QName("ns1", "typeA"));
        Record recordTypeB = newRecordOfType(new QName("ns1", "typeB"));

        assertEquals(ImmutableSet.of(vtag1.getId()),
                idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, recordTypeA).getVersionTags());
        assertEquals(ImmutableSet.of(vtag2.getId()),
                idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, recordTypeB).getVersionTags());
    }
View Full Code Here

                "xmlns:ns1='ns1'",
                Lists.newArrayList("recordType='ns1:*' vtags='vtag1'"),
                Collections.<String>emptyList()
        );

        LilyIndexerConf idxConf = LilyIndexerConfBuilder.build(new ByteArrayInputStream(conf.getBytes()), repository);

        Record recordNs1TypeA = newRecordOfType(new QName("ns1", "typeA"));
        Record recordNs2TypeA = newRecordOfType(new QName("ns2", "typeA"));

        assertNotNull(idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, recordNs1TypeA));
        assertNull(idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, recordNs2TypeA));
    }
View Full Code Here

            throw new AssertionError(e);
        } finally {
        }

        try {
            LilyIndexerConf lilyIndexerConf = LilyIndexerConfBuilder.build(new ByteArrayInputStream(confData), lRepository);
            LilyResultToSolrMapper mapper = new LilyResultToSolrMapper(indexName, lilyIndexerConf, lilyClient, zk);
            mapper.configure(params);
            return mapper;
        } catch (org.lilyproject.indexer.model.indexerconf.IndexerConfException e) {
            Closer.close(lilyClient);
View Full Code Here

TOP

Related Classes of org.lilyproject.indexer.model.indexerconf.LilyIndexerConf

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.