lucene-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kumaran <kums....@gmail.com>
Subject what is the difference between usages of ChainedFilter and FilterClause in lucene?
Date Wed, 09 Apr 2014 06:01:06 GMT
Am using lucene 3.0.3. i have two filters (BooleanFilter and
DistanceFilter).what is the best way to do logical operations between these
two filters?

BooleanFilter: ( OR,AND filters using FilterClause )

    BooleanFilter boolFilter = new BooleanFilter();
    Term term = new Term("city", "texas");
    TermsFilter filter = new TermsFilter();
    filter.addTerm(term);
    FilterClause filterClause = new FilterClause(filter,
BooleanClause.Occur.SHOULD);
    boolFilter.add(filterClause);

    Term term1 = new Term("skill", "java");
    TermsFilter filter1 = new TermsFilter();
    filter1.addTerm(term1);
    FilterClause filterClause1 = new FilterClause(filter1,
BooleanClause.Occur.MUST);
    boolFilter.add(filterClause1);

 Distancefilter:

DistanceQueryBuilder queryBuilder = new DistanceQueryBuilder(latitude,
longitude, radius, "lat", "lon",
CartesianTierPlotter.DEFALT_FIELD_PREFIX, true);Filter distFilter =
queryBuilder.getFilter()

 i have tried two options. Combining BooleanFilter and Distancefilter using
ChainedFilter. Next one is making another FilterClause for DistanceFilter.

ChainedFilter is working. FilterClause is not working.(trace in ERROR:)
Please explain me about general difference between ChainedFilter and
FilterClause in lucene ?

ERROR:

java.lang.NullPointerException at
org.apache.lucene.spatial.tier.DistanceFieldComparatorSource$DistanceScoreDocLookupComparator.copy(DistanceFieldComparatorSource.java:105)
at
org.apache.lucene.search.TopFieldCollector$OneComparatorNonScoringCollector.collect(TopFieldCollector.java:89)
at
org.apache.lucene.search.IndexSearcher.searchWithFilter(IndexSearcher.java:258)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:218) at
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:199) at
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:177) at
org.apache.lucene.search.Searcher.search(Searcher.java:49) at
com.zoho.training.RadialSearch.search(RadialSearch.java:246) at
com.zoho.training.RadialSearch.main(RadialSearch.java:281) Exception in
thread "main" java.lang.NullPointerException at
org.apache.lucene.spatial.tier.DistanceFieldComparatorSource$DistanceScoreDocLookupComparator.copy(DistanceFieldComparatorSource.java:105)
at
org.apache.lucene.search.TopFieldCollector$OneComparatorNonScoringCollector.collect(TopFieldCollector.java:89)
at
org.apache.lucene.search.IndexSearcher.searchWithFilter(IndexSearcher.java:258)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:218) at
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:199) at
org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:177) at
org.apache.lucene.search.Searcher.search(Searcher.java:49) at
com.zoho.training.RadialSearch.search(RadialSearch.java:246) at
com.zoho.training.RadialSearch.main(RadialSearch.java:281)

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message