Package org.apache.lucene.search

Examples of org.apache.lucene.search.Hit


        try {
            Searcher searcher = indexSearcher();
            Hits hits = searcher.search(query);
            log.info("Searched for: " + query + " in  " + (System.currentTimeMillis() - start) + " ms");
            for (Iterator iter = hits.iterator(); iter.hasNext();) {
                Hit hit = (Hit) iter.next();
                String gidString = hit.getDocument().getField(GID).stringValue();
                EOKeyGlobalID gid = ERXKeyGlobalID.fromString(gidString).globalID();
                result.addObject(gid);
            }
            log.info("Returning " + result.count() + " after " + (System.currentTimeMillis() - start) + " ms");
            return result;
View Full Code Here


            query.add(new TermQuery(new Term(GID, pk)), Occur.MUST);
            Hits hits = searcher.search(query);

            log.info("Searched for: " + query.toString(GID) + " in  " + (System.currentTimeMillis() - start) + " ms");
            for (Iterator iter = hits.iterator(); iter.hasNext();) {
                Hit hit = (Hit) iter.next();
                result.addObject(hit.getDocument());
            }
            log.info("Returning " + result.count() + " after " + (System.currentTimeMillis() - start) + " ms");
        } catch (IOException e) {
            throw NSForwardException._runtimeExceptionForThrowable(e);
        }
View Full Code Here

        LOG.debug("found " + hits.length() + " documents");
       
        Iterator<Hit> iterator = hits.iterator();
        while( iterator.hasNext())
        {
            Hit hit = iterator.next();
            Document d = hit.getDocument();
            LOG.debug(d.get("from") + ": " + d.get("subject") + " ---- Date: " + d.get("sent") + " ID: " + d.get("id"));
        }
    }
View Full Code Here

        try
        {
            Iterator<Hit> iterator = result.iterator();
            while( iterator.hasNext())
            {
                Hit hit = iterator.next();
                searchResult.add(hit.getDocument());
            }
        }
        catch( IOException ex)
        {
            throw new BusinessException("can't process search results", ex);
View Full Code Here

TOP

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

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.