lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Lea <ian....@gmail.com>
Subject Re: Custom Filter
Date Thu, 25 Mar 2010 09:48:38 GMT
Could this maybe have something to do with per-segment readers, as
mentioned in recent message from Daniel?

Posting lucene version and the full stack trace dump is always a good idea.


--
Ian.


On Wed, Mar 24, 2010 at 6:56 PM, Siraj Haider <siraj@jobdiva.com> wrote:
> Hello there,
> I am getting exception when running queries with new getDocIdSet() in my
> customer filter.  Following is the code for my getDocIdSet() function:
>
> /public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
>    OpenBitSet bitSet = new OpenBitSet(reader.maxDoc());
>    for (int i=0; i<reader.maxDoc(); i++) {
>      if (reader.isDeleted(i)) continue;
>      Document doc = reader.document(i);
>
>      if (doc.getValues("ZIPLAT"+t_id)==null ||
> doc.getValues("ZIPLON"+t_id)==null) continue;
>      try {
>        SpatialLocation teamLocation=new
> SpatialLocation(toRadians(doc.getValues("ZIPLON"+t_id)[0]),
> toRadians(doc.getValues("ZIPLAT"+t_id)[0]));
>        if (location.getDistance(teamLocation) <= radius) bitSet.set(i);
>      } catch (Exception e) {
>        e.printStackTrace(System.out);
>        continue;
>      }
>    }
>    return bitSet;
> }
> /
> I am searching with the following code:
> /        QueryParser queryParser = new QueryParser(""   , analyzer);
>
>        DisjunctionMaxQuery query = new DisjunctionMaxQuery(0);
>        for (int i=0; i<criterias.length; i++) {
>          Query subquery = queryParser.parse(criterias[i].criteria);
>          ZipcodeFilter zipFilter = null;
>          if (criterias[i].zipcode!=null) {
>            print("ZipFilter : " + criterias[i].zipcode.zip + " within " +
> criterias[i].zipcode.radius + " miles.");
>            zipFilter = new ZipcodeFilter(criterias[i].zipcode.latitude,
> criterias[i].zipcode.longitude, (double) criterias[i].zipcode.radius,
> teamID);
>            subquery = new FilteredQuery(subquery, zipFilter);
>          }
>          query.add(subquery);
>        }/
>
> As you can see, I have multiple queries combined using DisjunctionMaxQuery.
>  The search runs fine if with only one query, but if there are multiple
> queries, I get an ArrayIndexOutOfBoundException.
>
> Everything was running fine when I was using the depricated bits() method.
>  Do you think I am missing something?
>
> thanks in advance
> -siraj
>
>
>

---------------------------------------------------------------------
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