Package org.apache.lucene.search

Examples of org.apache.lucene.search.RangeFilter


                String max = null;
                if (search.getDateRangeMax() != null) {
                    max = DateTools.dateToString(search.getDateRangeMax(), DateTools.Resolution.DAY);
                }
                // ENT-271: don't include upper or lower bound if these elements are null
                filter = new RangeFilter("date", min, max, min != null, max != null );
            }

            // See if we need to match external conversations. This will only be true
            // when less than two conversation participants are specified and external
            // wildcard matching is enabled.
View Full Code Here


                            // check for date filter and search in index
                            Hits hits;
                            if (useDate.isSelected()) {
                                String dateFrom = DateTimeUtils.getDateStringForIndex(DateTimeUtils.getDateFromString(fromField.getText()));
                                String dateTo = DateTimeUtils.getDateStringForIndex(DateTimeUtils.getDateFromString(toField.getText()));
                                RangeFilter rangeFilter = new RangeFilter(Index.FIELD_MODDATE, dateFrom, dateTo, true, true);
                                if (logger.isDebugEnabled()) {
                                    logger.debug("doSearch() search with date range '" + rangeFilter + "'");
                                }

                                hits = searcher.search(query, rangeFilter);
View Full Code Here

    writer.addDocument(doc);
  }
 
  private Filter getRangeFilter(String field,String lowerPrice, String upperPrice)
  {
    return new RangeFilter(field,lowerPrice,upperPrice,true,true);
  }
View Full Code Here

   
    String lowerTerm=e.getAttribute("lowerTerm");
    String upperTerm=e.getAttribute("upperTerm");
    boolean includeLower=DOMUtils.getAttribute(e,"includeLower",true);
    boolean includeUpper=DOMUtils.getAttribute(e,"includeUpper",true);
    return new RangeFilter(fieldName,lowerTerm,upperTerm,includeLower,includeUpper);
  }
View Full Code Here

   
    String lowerTerm=e.getAttribute("lowerTerm");
    String upperTerm=e.getAttribute("upperTerm");
    boolean includeLower=DOMUtils.getAttribute(e,"includeLower",true);
    boolean includeUpper=DOMUtils.getAttribute(e,"includeUpper",true);
    return new RangeFilter(fieldName,lowerTerm,upperTerm,includeLower,includeUpper);
  }
View Full Code Here

    //Currently highlights "John" and "Kennedy" separately
    assertTrue("Failed to find correct number of highlights " + numHighlights + " found", numHighlights == 2);
  }
  public void testGetBestFragmentsFilteredQuery() throws Exception
  {
    RangeFilter rf=new RangeFilter("contents","john","john",true,true);
    SpanQuery clauses[]={
        new SpanTermQuery(new Term("contents","john")),
        new SpanTermQuery(new Term("contents","kennedy")),
        };
    SpanNearQuery snq=new SpanNearQuery(clauses,1,true);
View Full Code Here

    //Currently highlights "John" and "Kennedy" separately
    assertTrue("Failed to find correct number of highlights " + numHighlights + " found", numHighlights == 2);
  }
  public void testGetBestFragmentsFilteredPhraseQuery() throws Exception
  {
    RangeFilter rf=new RangeFilter("contents","john","john",true,true);
    PhraseQuery pq=new PhraseQuery();
    pq.add(new Term("contents","john"));
    pq.add(new  Term("contents","kennedy"));
    FilteredQuery fq=new FilteredQuery(pq,rf);
   
View Full Code Here

      match = hg.getBestFragment( new StandardAnalyzer(), "data", "help me [54-65]");
      assertEquals("<B>help</B> me [54-65]", match);
  }  
  public void testGetBestFragmentsFilteredQuery() throws Exception
  {
    RangeFilter rf=new RangeFilter("contents","john","john",true,true);
    SpanQuery clauses[]={
        new SpanTermQuery(new Term("contents","john")),
        new SpanTermQuery(new Term("contents","kennedy")),
        };
    SpanNearQuery snq=new SpanNearQuery(clauses,1,true);
View Full Code Here

    //Currently highlights "John" and "Kennedy" separately
    assertTrue("Failed to find correct number of highlights " + numHighlights + " found", numHighlights == 2);
  }
  public void testGetBestFragmentsFilteredPhraseQuery() throws Exception
  {
    RangeFilter rf=new RangeFilter("contents","john","john",true,true);
    PhraseQuery pq=new PhraseQuery();
    pq.add(new Term("contents","john"));
    pq.add(new  Term("contents","kennedy"));
    FilteredQuery fq=new FilteredQuery(pq,rf);
   
View Full Code Here

    writer.addDocument(doc);
  }
 
  private Filter getRangeFilter(String field,String lowerPrice, String upperPrice)
  {
    return new RangeFilter(field,lowerPrice,upperPrice,true,true);
  }
View Full Code Here

TOP

Related Classes of org.apache.lucene.search.RangeFilter

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.