Package org.apache.solr.core

Examples of org.apache.solr.core.SolrException



  public int getIntParam(String name) {
    String s = getParam(name);
    if (s==null) {
      throw new SolrException(500,"Missing required parameter '"+name+"' from " + this);
    }
    return Integer.parseInt(s);
  }
View Full Code Here


  }

  public String getStrParam(String name) {
    String s = getParam(name);
    if (s==null) {
      throw new SolrException(500,"Missing required parameter '"+name+"' from " + this);
    }
    return s;
  }
View Full Code Here

      // block other addDoc calls.  Hence, we synchronize to protect internal
      // state.  This is safe as all other state-changing operations are
      // protected with iwCommit (which iwAccess excludes from this block).
      synchronized (this) {
        if (!cmd.allowDups && !cmd.overwritePending && !cmd.overwriteCommitted) {
          throw new SolrException(400,"unsupported param combo:" + cmd);
          // this would need a reader to implement (to be able to check committed
          // before adding.)
          // return addNoOverwriteNoDups(cmd);
        } else if (!cmd.allowDups && !cmd.overwritePending && cmd.overwriteCommitted) {
          rc = addConditionally(cmd);
      } else if (!cmd.allowDups && cmd.overwritePending && !cmd.overwriteCommitted) {
          throw new SolrException(400,"unsupported param combo:" + cmd);
        } else if (!cmd.allowDups && cmd.overwritePending && cmd.overwriteCommitted) {
          rc = overwriteBoth(cmd);
        } else if (cmd.allowDups && !cmd.overwritePending && !cmd.overwriteCommitted) {
          rc = allowDups(cmd);
        } else if (cmd.allowDups && !cmd.overwritePending && cmd.overwriteCommitted) {
          throw new SolrException(400,"unsupported param combo:" + cmd);
        } else if (cmd.allowDups && cmd.overwritePending && !cmd.overwriteCommitted) {
          throw new SolrException(400,"unsupported param combo:" + cmd);
        } else if (cmd.allowDups && cmd.overwritePending && cmd.overwriteCommitted) {
          rc = overwriteBoth(cmd);
        }
        if (rc == -1)
          throw new SolrException(400,"unsupported param combo:" + cmd);
       
        if (rc == 1) {
          // adding document -- prep writer
          closeSearcher();
          openWriter();
View Full Code Here

    deleteByIdCommandsCumulative.incrementAndGet();

    if (!cmd.fromPending && !cmd.fromCommitted) {
      numErrors.incrementAndGet();
      numErrorsCumulative.incrementAndGet();
      throw new SolrException(400,"meaningless command: " + cmd);
    }
    if (!cmd.fromPending || !cmd.fromCommitted) {
      numErrors.incrementAndGet();
      numErrorsCumulative.incrementAndGet();
      throw new SolrException(400,"operation not supported" + cmd);
    }

    iwCommit.lock();
    try {
      pset.put(idFieldType.toInternal(cmd.id), ZERO);
View Full Code Here

     deleteByQueryCommandsCumulative.incrementAndGet();

     if (!cmd.fromPending && !cmd.fromCommitted) {
       numErrors.incrementAndGet();
       numErrorsCumulative.incrementAndGet();
       throw new SolrException(400,"meaningless command: " + cmd);
     }
     if (!cmd.fromPending || !cmd.fromCommitted) {
       numErrors.incrementAndGet();
       numErrorsCumulative.incrementAndGet();
       throw new SolrException(400,"operation not supported" + cmd);
     }

    boolean madeIt=false;
    try {
     Query q = QueryParsing.parseQuery(cmd.query, schema);
View Full Code Here

      // TODO: instead of prepending /prefix/, we could do the search rooted at /prefix...
      Object o = xpath.evaluate(xstr, doc, type);
      return o;

    } catch (XPathExpressionException e) {
      throw new SolrException(500,"Error in xpath:" + path +" for " + name,e,false);
    }
  }
View Full Code Here

      log.finest(name + ":" + path + "=" + nd);
      return nd;

    } catch (XPathExpressionException e) {
      SolrException.log(log,"Error in xpath",e);
      throw new SolrException(500,"Error in xpath:" + xstr + " for " + name,e,false);
    } catch (SolrException e) {
      throw(e);
    } catch (Throwable e) {
      SolrException.log(log,"Error in xpath",e);
      throw new SolrException(500,"Error in xpath:" + xstr+ " for " + name,e,false);
    }
  }
View Full Code Here

        } catch (ClassNotFoundException e1) {
          // ignore... assume first exception is best.
        }
      }

      throw new SolrException(500, "Error loading class '" + cname + "'", e, false);
    }
  }
View Full Code Here

  public static Object newInstance(String cname, String... subpackages) {
    Class clazz = findClass(cname,subpackages);
    try {
      return clazz.newInstance();
    } catch (Exception e) {
      throw new SolrException(500,"Error instantiating class " + clazz, e, false);
    }
  }
View Full Code Here

  public Field createField(SchemaField field, String externalVal, float boost) {
    String val;
    try {
      val = toInternal(externalVal);
    } catch (NumberFormatException e) {
      throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "Error while creating field '" + field + "' from value '" + externalVal + "'", e, false);
    }
    if (val==null) return null;
    if (!field.indexed() && !field.stored()) {
        log.finest("Ignoring unindexed/unstored field: " + field);
        return null;
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.