Package org.apache.solr.core

Examples of org.apache.solr.core.SolrException


      return query;

    } catch (ParseException e) {
      SolrCore.log(e);
      throw new SolrException(400,"Error parsing Lucene query",e);
    }
  }
View Full Code Here


    Field field = sfield.createField(val, boost);
    if (field != null) {
      if (!sfield.multiValued()) {
        String oldValue = map.put(sfield.getName(), val);
        if (oldValue != null) {
          throw new SolrException(400,"ERROR: multiple values encountered for non multiValued field " + sfield.getName()
                  + ": first='" + oldValue + "' second='" + val + "'");
        }
      }
      // field.setBoost(boost);
      doc.add(field);
View Full Code Here

      }
    }

    // error if this field name doesn't match anything
    if (sfield==null && (destArr==null || destArr.length==0)) {
      throw new SolrException(400,"ERROR:unknown field '" + name + "'");
    }
  }
View Full Code Here

  /**
   * @throws SolrException Base implementation does not allow modifications
   */
  public void add(int doc) {
    throw new SolrException(500,"Unsupported Operation");
  }
View Full Code Here

  /**
   * @throws SolrException Base implementation does not allow modifications
   */
  public void addUnique(int doc) {
    throw new SolrException(500,"Unsupported Operation");
  }
View Full Code Here

    closeSearcher(); openWriter();
    writer.addDocument(doc);
  }

  protected boolean existsInIndex(String indexedId) throws IOException {
    if (idField == null) throw new SolrException(2,"Operation requires schema to have a unique key field");

    closeWriter();
    openSearcher();
    IndexReader ir = searcher.getReader();
    TermDocs tdocs = null;
View Full Code Here

    return exists;
  }


  protected int deleteInIndex(String indexedId) throws IOException {
    if (idField == null) throw new SolrException(2,"Operation requires schema to have a unique key field");

    closeWriter(); openSearcher();
    IndexReader ir = searcher.getReader();
    TermDocs tdocs = null;
    int num=0;
View Full Code Here

  ****************************************************************/

  // could return the number of docs deleted, but is that always possible to know???
  public void delete(DeleteUpdateCommand cmd) throws IOException {
    if (!cmd.fromPending && !cmd.fromCommitted)
      throw new SolrException(400,"meaningless command: " + cmd);
    if (!cmd.fromPending || !cmd.fromCommitted)
      throw new SolrException(400,"operation not supported" + cmd);
    String indexedId = idFieldType.toInternal(cmd.id);
    synchronized(this) {
      deleteInIndex(indexedId);
      pset.remove(indexedId);
    }
View Full Code Here

  // TODO - return number of docs deleted?
  // Depending on implementation, we may not be able to immediately determine num...
  public void deleteByQuery(DeleteUpdateCommand cmd) throws IOException {
    if (!cmd.fromPending && !cmd.fromCommitted)
      throw new SolrException(400,"meaningless command: " + cmd);
    if (!cmd.fromPending || !cmd.fromCommitted)
      throw new SolrException(400,"operation not supported" + cmd);

    Query q = QueryParsing.parseQuery(cmd.query, schema);

    int totDeleted = 0;
    synchronized(this) {
View Full Code Here

      return addNoOverwriteNoDups(cmd);
    } else if (!cmd.allowDups && !cmd.overwritePending && cmd.overwriteCommitted) {
      return addConditionally(cmd);
    } else if (!cmd.allowDups && cmd.overwritePending && !cmd.overwriteCommitted) {
      // return overwriteBoth(cmd);
      throw new SolrException(400,"unsupported param combo:" + cmd);
    } else if (!cmd.allowDups && cmd.overwritePending && cmd.overwriteCommitted) {
      return overwriteBoth(cmd);
    } else if (cmd.allowDups && !cmd.overwritePending && !cmd.overwriteCommitted) {
      return allowDups(cmd);
    } else if (cmd.allowDups && !cmd.overwritePending && cmd.overwriteCommitted) {
      // return overwriteBoth(cmd);
      throw new SolrException(400,"unsupported param combo:" + cmd);
    } else if (cmd.allowDups && cmd.overwritePending && !cmd.overwriteCommitted) {
      // return overwriteBoth(cmd);
      throw new SolrException(400,"unsupported param combo:" + cmd);
    } else if (cmd.allowDups && cmd.overwritePending && cmd.overwriteCommitted) {
      return overwriteBoth(cmd);
    }
    throw new SolrException(400,"unsupported param combo:" + cmd);
  }
View Full Code Here

TOP

Related Classes of org.apache.solr.core.SolrException

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.