Examples of clauses()


Examples of org.apache.lucene.search.BooleanQuery.clauses()

   */
  static Query getAbs(Query q) {
    if (!(q instanceof BooleanQuery)) return q;
    BooleanQuery bq = (BooleanQuery)q;

    List<BooleanClause> clauses = bq.clauses();
    if (clauses.size()==0) return q;


    for (BooleanClause clause : clauses) {
      if (!clause.isProhibited()) return q;
View Full Code Here

Examples of org.apache.lucene.search.BooleanQuery.clauses()

    if (query instanceof SuperQuery) {
      SuperQuery superQuery = (SuperQuery) query;
      fixNegatives(superQuery.getQuery());
    } else if (query instanceof BooleanQuery) {
      BooleanQuery booleanQuery = (BooleanQuery) query;
      for (BooleanClause clause : booleanQuery.clauses()) {
        fixNegatives(clause.getQuery());
      }
      if (containsAllNegativeQueries(booleanQuery)) {
        if (containsSuperQueries(booleanQuery)) {
          booleanQuery.add(new TermQuery(_defaultPrimeDocTerm), Occur.SHOULD);
View Full Code Here

Examples of org.apache.lucene.search.BooleanQuery.clauses()

  }

  private boolean isSameGroupName(Query query, String groupName) {
    if (query instanceof BooleanQuery) {
      BooleanQuery booleanQuery = (BooleanQuery) query;
      for (BooleanClause clause : booleanQuery.clauses()) {
        if (!isSameGroupName(clause.getQuery(), groupName)) {
          return false;
        }
      }
      return true;
View Full Code Here

Examples of org.apache.lucene.search.BooleanQuery.clauses()

  }

  private String findFirstGroupName(Query query) {
    if (query instanceof BooleanQuery) {
      BooleanQuery booleanQuery = (BooleanQuery) query;
      for (BooleanClause clause : booleanQuery.clauses()) {
        return findFirstGroupName(clause.getQuery());
      }
      return null;
    } else if (query instanceof SuperQuery) {
      SuperQuery sq = (SuperQuery) query;
View Full Code Here

Examples of org.apache.lucene.search.BooleanQuery.clauses()

  private Filter buildNewFilter(Query query, ConcurrentMap<String, String> filterAlias, FilterParser filterParser)
      throws ParseException {
    if (query instanceof BooleanQuery) {
      BooleanQuery booleanQuery = (BooleanQuery) query;
      BooleanFilter booleanFilter = new BooleanFilter();
      for (BooleanClause clause : booleanQuery.clauses()) {
        booleanFilter.add(buildNewFilter(clause.getQuery(), filterAlias, filterParser), clause.getOccur());
      }
      return booleanFilter;
    } else if (query instanceof TermQuery) {
      TermQuery termQuery = (TermQuery) query;
View Full Code Here

Examples of org.apache.lucene.search.BooleanQuery.clauses()

    float boostFactor = 5;
    mlt.setBoostFactor(boostFactor);
   
    BooleanQuery query = (BooleanQuery) mlt.like(new StringReader(
        "lucene release"), "text");
    List<BooleanClause> clauses = query.clauses();
   
    assertEquals("Expected " + originalValues.size() + " clauses.",
        originalValues.size(), clauses.size());
   
    for (int i = 0; i < clauses.size(); i++) {
View Full Code Here

Examples of org.apache.lucene.search.BooleanQuery.clauses()

    mlt.setMinWordLen(1);
    mlt.setFieldNames(new String[] {"text"});
    mlt.setBoost(true);
    BooleanQuery query = (BooleanQuery) mlt.like(new StringReader(
        "lucene release"), "text");
    List<BooleanClause> clauses = query.clauses();
   
    for (int i = 0; i < clauses.size(); i++) {
      BooleanClause clause = clauses.get(i);
      TermQuery tq = (TermQuery) clause.getQuery();
      originalValues.put(tq.getTerm().text(), Float.valueOf(tq.getBoost()));
View Full Code Here

Examples of org.apache.lucene.search.BooleanQuery.clauses()

    float boostFactor = 5;
    mlt.setBoostFactor(boostFactor);
   
    BooleanQuery query = (BooleanQuery) mlt.like(new StringReader(
        "lucene release"), "text");
    List<BooleanClause> clauses = query.clauses();
   
    assertEquals("Expected " + originalValues.size() + " clauses.",
        originalValues.size(), clauses.size());

    for (BooleanClause clause : clauses) {
View Full Code Here

Examples of org.apache.lucene.search.BooleanQuery.clauses()

    mlt.setMinWordLen(1);
    mlt.setFieldNames(new String[] {"text"});
    mlt.setBoost(true);
    BooleanQuery query = (BooleanQuery) mlt.like(new StringReader(
        "lucene release"), "text");
    List<BooleanClause> clauses = query.clauses();

    for (BooleanClause clause : clauses) {
      TermQuery tq = (TermQuery) clause.getQuery();
      originalValues.put(tq.getTerm().text(), tq.getBoost());
    }
View Full Code Here

Examples of org.apache.lucene.search.BooleanQuery.clauses()

    float boostFactor = 5;
    mlt.setBoostFactor(boostFactor);
   
    BooleanQuery query = (BooleanQuery) mlt.like("text", new StringReader(
        "lucene release"));
    List<BooleanClause> clauses = query.clauses();
   
    assertEquals("Expected " + originalValues.size() + " clauses.",
        originalValues.size(), clauses.size());

    for (BooleanClause clause : clauses) {
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.