Package org.carrot2.source

Examples of org.carrot2.source.SearchEngineResponse


    @Before
    public void prepare()
    {
        spriteDirectiveOccurrenceCollector = new SpriteDirectiveOccurrenceCollector(
            messageLog, new FileSystemResourceHandler(null,
                SmartSpritesParameters.DEFAULT_CSS_FILE_ENCODING, messageLog));
    }
View Full Code Here


         * memory leaks when reloading Web applications. Consider: 1) patching rome
         * fetcher sources and adding Connection: close to request headers, 2) using
         * Apache HttpClient, 3) using manual fetch of the syndication feed.
         */
        final SyndFeed feed = feedFetcher.retrieveFeed(new URL(url));
        final SearchEngineResponse response = new SearchEngineResponse();

        // The documentation does not mention that null value can be returned
        // but we've seen a NPE here:
        // http://builds.carrot2.org/browse/C2HEAD-SOURCES-4.
        if (feed != null)
View Full Code Here

    }

    @Override
    public SearchEngineResponse fetchSearchResponse() throws Exception
    {
        final SearchEngineResponse response = new SearchEngineResponse();

        // Run sub-components sequentially so that we have a chance to weed out spammers
        // before we query Google.
        try {
            // String equality intentional; will work for tests only.
View Full Code Here

     */
    public void process() throws ProcessingException
    {
        try
        {
            final SearchEngineResponse response = fetchSearchResponse();
            documents = response.results;
            resultsTotal = response.getResultsTotal();
        }
        catch (Exception e)
        {
            throw ExceptionUtils.wrapAs(ProcessingException.class, e);
        }
View Full Code Here

                query = new MultiFieldQueryParser(luceneVersion, searchFields,
                    analyzer).parse(textQuery);
            }
        }

        final SearchEngineResponse response = new SearchEngineResponse();
        final IndexSearcher searcher = indexOpen(directory);
        final TopDocs docs = searcher.search((Query) query, null, results);

        response.metadata.put(SearchEngineResponse.RESULTS_TOTAL_KEY, docs.totalHits);
View Full Code Here

    @Override
    protected SearchEngineResponse fetchSearchResponse() throws Exception
    {
        final String serviceURL = buildServiceUrl();
        final SearchEngineResponse response = new SearchEngineResponse();

        final ProcessingResult processingResult = loadProcessingResult(
                serviceURL,
                toCarrot2Xslt,
                getXsltParameters(),
View Full Code Here

        reader.setContentHandler(searchHandler);
       
        byte [] bytes = Resources.toByteArray(Resources.getResource(PubMedContentHandlerTest.class, "abstracts.xml"));
        reader.parse(new InputSource(new ByteArrayInputStream(bytes)));

        SearchEngineResponse response = searchHandler.getResponse();
        List<String> pmids = Lists.newArrayList();
        for (Document doc : response.results)
        {
            if ("24009777".equals(doc.getStringId())) {
                assertThat(doc.getTitle()).startsWith("Role of choline deficiency in the Fatty liver");
View Full Code Here

    @Override
    protected SearchEngineResponse fetchSearchResponse() throws Exception
    {
        PubMedIdSearchHandler idResponse = getPubMedIds(query, results);
        SearchEngineResponse response = getPubMedAbstracts(idResponse.getPubMedPrimaryIds());
        response.metadata.put(SearchEngineResponse.RESULTS_TOTAL_KEY, idResponse.getMatchCount());
        return response;
    }
View Full Code Here

     */
    private SearchEngineResponse getPubMedAbstracts(List<String> ids) throws Exception
    {
        if (ids.isEmpty())
        {
            return new SearchEngineResponse();
        }
       
        final XMLReader reader = newXmlReader();
        final PubMedContentHandler fetchHandler = new PubMedContentHandler();
        reader.setContentHandler(fetchHandler);
View Full Code Here

    }
   
    @Override
    public void startDocument() throws SAXException
    {
        this.response = new SearchEngineResponse();
    }
View Full Code Here

TOP

Related Classes of org.carrot2.source.SearchEngineResponse

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.