Package org.apache.nutch.searcher

Examples of org.apache.nutch.searcher.QueryException


        String message = "Wrong query syntax " + FIELD_NAME
          + ":" + dateTerm + ". Must be standalone 14 digit " +
          " IA format date or a range with a hyphen between.";
        LOGGER.error(message);
       
        throw new QueryException(message);
      }

      // So, date is in one of 2 possible formats.  First is standalone
      // 14 character IA date.
      String d = matcher.group(1);
     
      if (d != null)
      {
        LOGGER.debug("Found single date: " + d);

        // This is not a range query. Take the passed date and convert
        // it to seconds-since-epoch.
        BooleanQuery bq = new BooleanQuery();
       
        bq.add(new TermQuery(getTerm(getSeconds(pad(d)))),
          BooleanClause.Occur.SHOULD);
       
        output.add(bq,
          (c.isRequired() == true && c.isProhibited() == false)?
          BooleanClause.Occur.MUST:
          (c.isRequired() == false && c.isProhibited() == false)?
          BooleanClause.Occur.SHOULD:
          BooleanClause.Occur.MUST_NOT);

        continue;
      }

      // OK, must be 2nd possibility: DIGITS-DIGITS.
      String lower = matcher.group(2);
      String upper = matcher.group(3);
     
      if (lower != null && upper != null)
      {
        doRangeQuery(output, c, lower, upper);
     
        continue;
      }

      String message = "Unparseable query " + dateTerm + " (Is " +
        "it in 14 digit IA date format?)";
     
      LOGGER.error(message);
     
      throw new QueryException(message);
    }

    return output;
  }
View Full Code Here


   
    if (iUpper < iLower)
    {
      String message = upper + " must be > than " + lower;
      LOGGER.error(message);
      throw new QueryException(message);
    }
   
    // Inclusive of upper term.
    RangeQuery rangeQuery = new RangeQuery(getTerm(iLower),
      getTerm(iUpper), true);
View Full Code Here

    }
    catch (Exception e)
    {
      String message = "Failed parse of " + s + e.getMessage();
     
      throw new QueryException(message);
    }
   
    long seconds = d.getTime()/1000;
   
    if (seconds > Integer.MAX_VALUE)
View Full Code Here

        String message = "Wrong query syntax " + FIELD_NAME
          + ":" + dateTerm + ". Must be standalone 14 digit " +
          " IA format date.";
        LOGGER.error(message);
       
        throw new QueryException(message);
      }

      // So, date is in one format.
      // 14 character IA date.
      String d = matcher.group(1);
     
      if (d != null)
      {
        LOGGER.debug("Found single date: " + d);

        // This is not a range query. Take the passed date and convert
        // it to seconds-since-epoch.     
        output.add(new PwaClosestQuery(getTerm(getSeconds(pad(d)))),
                (c.isProhibited()
                    ? BooleanClause.Occur.MUST_NOT
                    : (c.isRequired()
                        ? BooleanClause.Occur.MUST
                        : BooleanClause.Occur.SHOULD
                       )
                 ));
       
        continue;
      }  

      String message = "Unparseable query " + dateTerm + " (Is " +
        "it in 14 digit IA date format?)";
     
      LOGGER.error(message);
     
      throw new QueryException(message);
    }

    return output;
  }
View Full Code Here

    }
    catch (Exception e)
    {
      String message = "Failed parse of " + s + e.getMessage();
     
      throw new QueryException(message);
    }
   
    long seconds = d.getTime()/1000;
   
    if (seconds > Integer.MAX_VALUE)
View Full Code Here

           
      String x = c.getTerm().toString();
      
      Matcher matcher = pattern.matcher(x);
      if (!matcher.matches()) {
        throw new QueryException("Wrong query syntax "+FIELD_NAME+":"+x);
      }

      // do it as lucene RangeQuery
      Term xLower = new Term(FIELD_NAME, matcher.group(1));
      Term xUpper = new Term(FIELD_NAME, matcher.group(2));
View Full Code Here

           
      String x = c.getTerm().toString();
      
      Matcher matcher = pattern.matcher(x);
      if (!matcher.matches()) {
        throw new QueryException("Wrong query syntax "+FIELD_NAME+":"+x);
      }

      // do it as lucene RangeQuery
      Term xLower = new Term(FIELD_NAME, matcher.group(1));
      Term xUpper = new Term(FIELD_NAME, matcher.group(2));
View Full Code Here

           
      String x = c.getTerm().toString();
      
      Matcher matcher = pattern.matcher(x);
      if (!matcher.matches()) {
        throw new QueryException("Wrong query syntax "+FIELD_NAME+":"+x);
      }

      // do it as lucene RangeQuery
      String xLower = matcher.group(1);
      String xUpper = matcher.group(2);
View Full Code Here

           
      String x = c.getTerm().toString();
      
      Matcher matcher = pattern.matcher(x);
      if (!matcher.matches()) {
        throw new QueryException("Wrong query syntax "+FIELD_NAME+":"+x);
      }

      // do it as lucene RangeQuery
      Term xLower = new Term(FIELD_NAME, matcher.group(1));
      Term xUpper = new Term(FIELD_NAME, matcher.group(2));
View Full Code Here

TOP

Related Classes of org.apache.nutch.searcher.QueryException

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.