Package org.apache.lucene.gdata.search.config

Examples of org.apache.lucene.gdata.search.config.IndexSchema


public class TestGdataQueryParser extends TestCase {

   
    public void testConstructor(){
        String field = "someField";
        IndexSchema s = new IndexSchema();
        s.setDefaultSearchField(field);
        GDataQueryParser p = new GDataQueryParser(s);
        assertEquals(field,p.getField());
        assertEquals(Operator.AND,p.getDefaultOperator());
        assertEquals(StandardAnalyzer.class,p.getAnalyzer().getClass());
    }
View Full Code Here


    /*
     * @see junit.framework.TestCase#setUp()
     */
    @Override
    protected void setUp() throws Exception {
        this.schema = new IndexSchema();
        //must be set
        this.schema.setDefaultSearchField(CONTENT_FIELD);
        this.schema.setIndexLocation("/tmp/");
        this.schema.setName(ProvidedServiceStub.SERVICE_NAME);
        IndexSchemaField field = new IndexSchemaField();
View Full Code Here

       
    }
   
    @SuppressWarnings("unchecked")
    private void applyRequestParameter() throws GDataRequestException{
        IndexSchema schema = this.configurator.getIndexSchema();
        try{
        this.translatedSearchQuery = QueryTranslator.translateHttpSearchRequest(schema,this.request.getParameterMap(),this.categoryQuery);
        }catch (Exception e) {
            throw new GDataRequestException("Can not translate user query to search query",e,GDataResponse.BAD_REQUEST);
        }
View Full Code Here

        this.indexLocation = new File(System.getProperty("java.io.tmpdir"));
       
       
        ProvidedServiceStub stub = new ProvidedServiceStub();
        this.schema = new IndexSchema();
        // must be set
        this.schema.setDefaultSearchField("content");
        this.schema.setName(ProvidedServiceStub.SERVICE_NAME);
        this.schema.setIndexLocation(this.indexLocation.getAbsolutePath());
        IndexSchemaField field = new IndexSchemaField();
View Full Code Here

    IndexSchema schemaPerFielAnalyzer;
    long VALUE_GT_DEFAULT_LONG = 15000;
    int VALUE_GT_DEFAULT_INT = 10000;
   
    protected void setUp() throws Exception {
        this.schemaNoPerFielAnalyzer = new IndexSchema();
        this.schemaPerFielAnalyzer = new IndexSchema();
        IndexSchemaField field = new IndexSchemaField();
        field.setName("someField");
        field.setAnalyzerClass(StopAnalyzer.class);
        this.schemaPerFielAnalyzer.addSchemaField(field);
        this.schemaPerFielAnalyzer.setCommitLockTimeout(VALUE_GT_DEFAULT_LONG);
View Full Code Here

        entry.setVersionId("1");
        entry.setFeedId("myFeed");
        entry.setId(ID);
        entry.setContent(new PlainTextConstruct(CONTENT));
        entry.setServiceConfig(new ProvidedServiceStub());
        IndexSchema schema = new IndexSchema();
        schema.setName("mySchema");
        IndexSchemaField field = new IndexSchemaField();
        field.setName(CONTENT_FIELD);
        field.setPath("/entry/content");
        field.setContentType(ContentType.TEXT);
        schema.addSchemaField(field);
        this.fineBuilder = new IndexDocumentBuilderTask(entry,schema,IndexAction.INSERT,true,true);
       
        /*
         * two fields, one will fail due to broken xpath.
         * One will remain.
         */
        schema = new IndexSchema();
        schema.setName("mySchema");
        field = new IndexSchemaField();
        field.setName("someContent");
        //broken xpath
        field.setPath("/entry///wrongXPath");
        field.setContentType(ContentType.TEXT);
        schema.addSchemaField(field);
        field = new IndexSchemaField();
        field.setName(CONTENT_FIELD);
        field.setPath("/entry/content");
        field.setContentType(ContentType.TEXT);
        schema.addSchemaField(field);
        this.failInStrategyBuilder = new IndexDocumentBuilderTask(entry,schema,IndexAction.INSERT,false,false);
        //fail with no fields
        schema = new IndexSchema();
        schema.setName("mySchema");
        this.zeroFields = new IndexDocumentBuilderTask(entry,schema,IndexAction.INSERT,false,false);
       
       
    }
View Full Code Here

        }catch (Exception e) {

        }
        ProvidedService configurator = new ProvidedServiceStub();
        GDataServerRegistry.getRegistry().registerService(configurator);
        IndexSchema schema = new IndexSchema();
        //must be set
        schema.setDefaultSearchField("field");
        schema.setIndexLocation("/tmp/");
        schema.setName(ProvidedServiceStub.SERVICE_NAME);
       
        ((ProvidedServiceStub)configurator).setIndexSchema(schema);
           
        this.control = MockControl.createControl(HttpServletRequest.class);
        this.request = (HttpServletRequest) this.control.getMock();
View Full Code Here

                .getRegistry().getServices();
        this.indexerMap = new ConcurrentHashMap<String, ServiceIndex>(services
                .size());
      
        for (ProvidedService service : services) {
            IndexSchema schema = service.getIndexSchema();
            /*
             * initialize will fail if mandatory values are not set. This is
             * just a
             */
            schema.initialize();
            addIndexSchema(schema);
        }
        this.isInitialized.set(true);
       

View Full Code Here

         * thread. Using fairness is slower but is acceptable in this context
         */
        Lock lock = bean.getLock();
        lock.lock();
        try {
            IndexSchema schema = bean.getSchema();
            boolean commitAfter = bean.incrementActionAndReset(schema.getCommitAfterDocuments());
            IndexDocumentBuilder<IndexDocument> callable = new IndexDocumentBuilderTask<IndexDocument>(
                    entry, bean.getSchema(), action, commitAfter,bean.getOptimize(schema.getOptimizeAfterCommit()));
            sumbitTask(callable,bean.getIndexer());
        } finally {
            /*
             * make sure to unlock
             */
 
View Full Code Here

TOP

Related Classes of org.apache.lucene.gdata.search.config.IndexSchema

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.