querystring = stripAsterisk      ( querystring );
    public static QueryResults doQuery(Context c, QueryArgs args)        throws IOException    {        String querystring = args.getQuery();        QueryResults qr    = new QueryResults();        List hitHandles    = new ArrayList();        List hitTypes      = new ArrayList();                // set up the QueryResults object        qr.setHitHandles( hitHandles );        qr.setHitTypes( hitTypes );        qr.setStart( args.getStart() );        qr.setPageSize( args.getPageSize() );                // massage the query string a bit                            querystring = checkEmptyQuery    ( querystring );  // change nulls to an empty string        querystring = workAroundLuceneBug( querystring );  // logicals changed to && ||, etc.        querystring = stripHandles       ( querystring );  // remove handles from query string        try        {            // grab a searcher, and do the search            Searcher searcher = getSearcher( ConfigurationManager.getProperty("search.dir") );                        QueryParser qp = new QueryParser("default", new DSAnalyzer());            Query myquery = qp.parse(querystring);            Hits hits     = searcher.search(myquery);                        // set total number of hits            qr.setHitCount( hits.length() );            // We now have a bunch of hits - snip out a 'window'            // defined in start, count and return the handles            // from that window                        // first, are there enough hits?            if( args.getStart() < hits.length() )            {                // get as many as we can, up to the window size                                // how many are available after snipping off at offset 'start'?                int hitsRemaining = hits.length() - args.getStart();                                 int hitsToProcess = ( hitsRemaining < args.getPageSize() )                                ? hitsRemaining : args.getPageSize();                                                for( int i = args.getStart(); i < args.getStart() + hitsToProcess; i++ )                {                    Document d = hits.doc(i);                    String handleText = d.get("handle");                    String handletype = d.get("type"  );                                    hitHandles.add(handleText);                                        if( handletype.equals( "" + Constants.ITEM ) )                    {                        hitTypes.add( new Integer( Constants.ITEM ) );                    }                    else if( handletype.equals( "" + Constants.COLLECTION ) )                    {                        hitTypes.add( new Integer( Constants.COLLECTION ) );                    }                    else if( handletype.equals( "" + Constants.COMMUNITY ) )                    {                        hitTypes.add( new Integer( Constants.COMMUNITY ) );                    }                    else                    {                        // error!  unknown type!                    }                }            }        }        catch (NumberFormatException e)        {            // a bad parse means that there are no results            // doing nothing with the exception gets you            //   throw new SQLException( "Error parsing search results: " + e );            // ?? quit?        }        catch (ParseException e)        {            // a parse exception - log and return null results            log.warn(LogManager.getHeader(c,                "Lucene Parse Exception",                "" + e));        }        return qr;    }