Package com.k_int.IR

Examples of com.k_int.IR.SearchTask


                q.query = new com.k_int.IR.QueryModels.RPNTree(rn);

                // Process the query
                LOGGER.finer("Create Search Task with query:" + q);

                SearchTask st = search_service.createTask(q,
                        search_request.referenceId);

                // Evaluate the query, waiting 10 seconds for the task to complete.
                //We really want to be
                // able to pass in a predicate to wait for here,
                //e.g. evaluate(10000, "NumHits > 100 OR Status=Complete");
                LOGGER.finer("Evaluate Search Task");

                try {
                    st.evaluate(10000);
                } catch (TimeoutExceededException tee) {
                    LOGGER.finer(
                        "Timeout exceeded waiting for search to complete");
                }

                if (search_request.resultSetName != null) {
                    LOGGER.finer("putting st with name "
                        + search_request.resultSetName);
                    active_searches.put(search_request.resultSetName, st);
                }

                active_searches.put("Default", st);

                // Result records processing
                int result_count = st.getTaskResultSet().getFragmentCount();
                LOGGER.finer("result count is " + result_count);

                // Number of hits
                response.resultCount = BigInteger.valueOf(result_count);

                // Figure out Search Status
                if ((st.getTaskStatusCode() != SearchTask.TASK_FAILURE)) {
                    response.searchStatus = Boolean.TRUE;
                } else {
                    // Figure out Result Set Status
                    switch (st.getTaskStatusCode()) {
                    //case SearchTask.TASK_EXECUTING_ASYNC:
                    case SearchTask.TASK_EXECUTING:

                        // resultSetStatus = 2 (interim) Partial results available,
                        //not necessarily valid
View Full Code Here


        PresentResponse_type response = new PresentResponse_type();
        pdu.o = response;
        response.referenceId = present_request.referenceId;
        response.otherInfo = null;

        SearchTask st = (SearchTask) (active_searches.get(present_request.resultSetId));

        if (st == null) {
            st = (SearchTask) (active_searches.get("Default"));
        }

        //the last search done is always stored in the hashtable
        //with both the resultSetName of the searchRequest and the value "Default"
        //So if the resultSetId can't be found the last search task is used.
        int start = present_request.resultSetStartPoint.intValue();
        int count = present_request.numberOfRecordsRequested.intValue();

        response.records = createRecordsFor(st,
                present_request.preferredRecordSyntax, start, count,
                requested_element_set);

        if (response.records.which == Records_type.responserecords_CID) {
            // Looks like we managed to present some records OK..
            response.numberOfRecordsReturned = BigInteger.valueOf(((Vector) (response.records.o))
                    .size());

            if ((start + count) >= st.getTaskResultSet().getFragmentCount()) {
                response.nextResultSetPosition = BigInteger.valueOf(0);
            } else {
                response.nextResultSetPosition = BigInteger.valueOf(start
                        + count);
            }
View Full Code Here

    public void testCreateTask() {
        geoSource = new GeoSearchable();
        geoSource.init(testProps);

        SearchTask task = geoSource.createTask(testQuery, null);
        assertTrue(task.getQuery().equals(testQuery));
    }
View Full Code Here

TOP

Related Classes of com.k_int.IR.SearchTask

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.