lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Tiger" <m.scott.ti...@gmail.com>
Subject Is there a FilterQueryParser?
Date Tue, 18 Sep 2007 18:31:29 GMT
I want get BooleanFilter contains two RangeFilters from query string.
Can I use FilterQuery to get RangeFilter?

example:

my query string:

  field1:[0 TO 100] AND field2:[1000 TO 2000]

BooleanFilter I want:
  BooleanFilter bf = new BooleanFilter();
  bf.add(
    new FilterClause(
      new RangeFilter("field1","0", "100", true, true),
      BooleanClause.Occur.MUST
    )
  );
  bf.add(
    new FilterClause(
      new RangeFilter("field2", "1000", "2000", true, true),
      BooleanClause.Occur.MUST
    )
  );

QueryFilter example:
  QueryParser qp = new QueryParser("", new KeywordAnalyzer());
  Query query = qp.parse("field1:[0 TO 100] AND filed2:[1000 TO 2000]");
  Filter filter = new CachingWrapperFilter(new QueryWrapperFilter(query));

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message