Examples of IndexSchema


Examples of com.alibaba.wasp.protobuf.generated.MetaProtos.IndexSchema

   * @see {@link #toByteArray()}
   */
  public static Index parseIndexFrom(final byte[] bytes)
      throws DeserializationException {
    try {
      IndexSchema is = IndexSchema.newBuilder()
          .mergeFrom(bytes, 0, bytes.length).build();
      return convert(is);
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw new DeserializationException(e);
    }
View Full Code Here

Examples of com.nearinfinity.honeycomb.mysql.schema.IndexSchema

        proxy.openTable(TEST_TABLE_NAME);

        verify(storeFactory, times(1)).createStore(eq(TEST_TABLE_NAME));
        verify(storageMock, times(1)).openTable(eq(TEST_TABLE_NAME));

        final IndexSchema uniqueIndex = new IndexSchema("uniqueIdx", ImmutableList.<String>of(TEST_COLUMN), true);
        proxy.addIndex(TEST_INDEX, uniqueIndex.serialize());

        verify(storageMock, never()).addIndex(eq(TEST_TABLE_NAME), eq(INDEX_SCHEMA));
        verify(tableMock, never()).insertTableIndex(eq(INDEX_SCHEMA));
        verify(tableMock, never()).flush();
    }
View Full Code Here

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

Examples of org.apache.solr.schema.IndexSchema

      this.searcher=searcher;
      this.isStore=new boolean[this.fields.length];
      this.fieldsnostore=new String[this.fields.length];
     
      this.ftlist=new FieldType[fields.length];
      IndexSchema schema=this.searcher.getSchema();

      ArrayList<String> storedField=new ArrayList<String>();
     
      for (int j = 0; j < fields.length; j++) {
        ftlist[j]=schema.getFieldType(fields[j]);
        this.isStore[j]=schema.getField(fields[j]).stored();
        this.fieldsnostore[j]=fields[j];
        if(this.isStore[j])
        {
          storedField.add(fields[j]);
          this.fieldsnostore[j]="higoempty_"+j+"_s";
View Full Code Here

Examples of org.apache.solr.schema.IndexSchema

   
    return LeftArr;
  }
  private void makejoin() throws IOException
  {
    IndexSchema schema=null;
    if(this.leftreader!=null)
    {
      schema=this.schema;
    }else{
      schema=readerleft.getSchema();
    }
   
    FieldType ftleft=schema.getFieldType(fieldLeft);
   
    String prefixLeft=TrieField.getMainValuePrefix(ftleft);
    Term tiLeft=new Term(fieldLeft, prefixLeft==null?"":prefixLeft);
    TermEnum teLeft = null;
    TermDocs tdleft=null;
View Full Code Here

Examples of org.apache.solr.schema.IndexSchema

      rtn.add("fdtcre", crcvalue);
      if(cache!=null)
      {
        MapFieldSelector selector=new MapFieldSelector(fields);
        FieldType[] ftlist=new FieldType[fields.length];
        IndexSchema schema=this.searcher.getSchema();

        for (int j = 0; j < fields.length; j++) {
          ftlist[j]=schema.getFieldType(fields[j]);
         
        }

        String crcliststr=params.get("mdrill.crc.key.get.crclist");
        if(crcliststr!=null)
View Full Code Here

Examples of org.apache.solr.schema.IndexSchema

  public static final int DEFAULT_COUNT = 10;
 
  @Override
  public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception
  {   
    IndexSchema schema = req.getSchema();
    SolrIndexSearcher searcher = req.getSearcher();
    IndexReader reader = searcher.getReader();
    SolrParams params = req.getParams();
    int numTerms = params.getInt( NUMTERMS, DEFAULT_COUNT );
       
    // Always show the core lucene info
    rsp.add("index", getIndexInfo(reader, numTerms>0 ) );

    Integer docId = params.getInt( DOC_ID );
    if( docId == null && params.get( ID ) != null ) {
      // Look for something with a given solr ID
      SchemaField uniqueKey = schema.getUniqueKeyField();
      String v = uniqueKey.getType().toInternal( params.get(ID) );
      Term t = new Term( uniqueKey.getName(), v );
      docId = searcher.getFirstMatch( t );
      if( docId < 0 ) {
        throw new SolrException( SolrException.ErrorCode.NOT_FOUND, "Can't find document: "+params.get( ID ) );
View Full Code Here

Examples of org.apache.solr.schema.IndexSchema

  private static SimpleOrderedMap<Object> getIndexedFieldsInfo(
    final SolrIndexSearcher searcher, final Set<String> fields, final int numTerms )
    throws Exception {

    IndexReader reader = searcher.getReader();
    IndexSchema schema = searcher.getSchema();
   
    // Walk the term enum and keep a priority queue for each map in our set
    Map<String,TopTermQueue> ttinfo = null;
    if( numTerms > 0 ) {
      ttinfo = getTopTerms(reader, fields, numTerms, null );
    }
    SimpleOrderedMap<Object> finfo = new SimpleOrderedMap<Object>();
    Collection<String> fieldNames = reader.getFieldNames(IndexReader.FieldOption.ALL);
    for (String fieldName : fieldNames) {
      if( fields != null && !fields.contains( fieldName ) ) {
        continue; // if a field is specified, only them
      }
     
      SimpleOrderedMap<Object> f = new SimpleOrderedMap<Object>();
     
      SchemaField sfield = schema.getFieldOrNull( fieldName );
      FieldType ftype = (sfield==null)?null:sfield.getType();

      f.add( "type", (ftype==null)?null:ftype.getTypeName() );
      f.add( "schema", getFieldFlags( sfield ) );
      if (sfield != null && schema.isDynamicField(sfield.getName()) && schema.getDynamicPattern(sfield.getName()) != null) {
        f.add("dynamicBase", schema.getDynamicPattern(sfield.getName()));
      }

      // If numTerms==0, the call is just asking for a quick field list
      if( ttinfo != null && sfield != null && sfield.indexed() ) {
        Query q = new TermRangeQuery(fieldName,null,null,false,false);
View Full Code Here

Examples of org.apache.solr.schema.IndexSchema

    if (fldLst == null) {
      fldLst = params.get(CommonParams.FL);
    }

    //use this to validate our fields
    IndexSchema schema = rb.req.getSchema();
    //Build up our per field mapping
    Map<String, FieldOptions> fieldOptions = new HashMap<String, FieldOptions>();
    NamedList<List<String>>  warnings = new NamedList<List<String>> ();
    List<String>  noTV = new ArrayList<String>();
    List<String>  noPos = new ArrayList<String>();
    List<String>  noOff = new ArrayList<String>();

    //we have specific fields to retrieve
    if (fldLst != null) {
      String [] fields = SolrPluginUtils.split(fldLst);
      for (String field : fields) {
        SchemaField sf = schema.getFieldOrNull(field);
        if (sf != null) {
          if (sf.storeTermVector()) {
            FieldOptions option = fieldOptions.get(field);
            if (option == null) {
              option = new FieldOptions();
              option.fieldName = field;
              fieldOptions.put(field, option);
            }
            //get the per field mappings
            option.termFreq = params.getFieldBool(field, TermVectorParams.TF, allFields.termFreq);
            option.docFreq = params.getFieldBool(field, TermVectorParams.DF, allFields.docFreq);
            option.tfIdf = params.getFieldBool(field, TermVectorParams.TF_IDF, allFields.tfIdf);
            //Validate these are even an option
            option.positions = params.getFieldBool(field, TermVectorParams.POSITIONS, allFields.positions);
            if (option.positions && !sf.storeTermPositions()){
              noPos.add(field);
            }
            option.offsets = params.getFieldBool(field, TermVectorParams.OFFSETS, allFields.offsets);
            if (option.offsets && !sf.storeTermOffsets()){
              noOff.add(field);
            }
          } else {//field doesn't have term vectors
            noTV.add(field);
          }
        } else {
          //field doesn't exist
          throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "undefined field: " + field);
        }
      }
    } //else, deal with all fields
    boolean hasWarnings = false;
    if (!noTV.isEmpty()) {
      warnings.add("noTermVectors", noTV);
      hasWarnings = true;
    }
    if (!noPos.isEmpty()) {
      warnings.add("noPositions", noPos);
      hasWarnings = true;
    }
    if (!noOff.isEmpty()) {
      warnings.add("noOffsets", noOff);
      hasWarnings = true;
    }
    if (hasWarnings) {
      termVectors.add("warnings", warnings);
    }

    DocListAndSet listAndSet = rb.getResults();
    List<Integer> docIds = getInts(params.getParams(TermVectorParams.DOC_IDS));
    Iterator<Integer> iter;
    if (docIds != null && !docIds.isEmpty()) {
      iter = docIds.iterator();
    } else {
      DocList list = listAndSet.docList;
      iter = list.iterator();
    }
    SolrIndexSearcher searcher = rb.req.getSearcher();

    IndexReader reader = searcher.getReader();
    //the TVMapper is a TermVectorMapper which can be used to optimize loading of Term Vectors
    SchemaField keyField = schema.getUniqueKeyField();
    String uniqFieldName = null;
    if (keyField != null) {
      uniqFieldName = keyField.getName();
    }
    //Only load the id field to get the uniqueKey of that field
View Full Code Here

Examples of org.apache.solr.schema.IndexSchema

    dataDir = SolrResourceLoader.normalizeDir(dataDir);

    log.info(logid+"Opening new SolrCore at " + resourceLoader.getInstanceDir() + ", dataDir="+dataDir);

    if (schema==null) {
      schema = new IndexSchema(config, IndexSchema.DEFAULT_SCHEMA_FILE, null);
    }

    //Initialize JMX
//    if (config.jmxConfig.enabled) {
//      infoRegistry = new JmxMonitoredMap<String, SolrInfoMBean>(name, String.valueOf(this.hashCode()), config.jmxConfig);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.