Merge branch 'master' into fetch_more
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 4 Feb 2013 10:24:46 +0000 (11:24 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 4 Feb 2013 10:24:46 +0000 (11:24 +0100)
1  2 
src/session.c

diff --combined src/session.c
@@@ -653,7 -653,7 +653,7 @@@ static void session_sort_unlocked(struc
      int type  = sp->type;
      int clients_research = 0;
  
-     yaz_log(YLOG_LOG, "session_sort field=%s increasing=%d type=%d", field, increasing, type);
+     yaz_log(YLOG_DEBUG, "session_sort field=%s increasing=%d type=%d", field, increasing, type);
      /* see if we already have sorted for this criteria */
      for (sr = se->sorted_results; sr; sr = sr->next)
      {
@@@ -734,7 -734,6 +734,6 @@@ enum pazpar2_error_code session_search(
      int no_failed_query = 0;
      int no_failed_limit = 0;
      struct client_list *l, *l0;
-     int same_sort_order = 0;
  
      session_log(se, YLOG_DEBUG, "Search");
  
      session_enter(se, "session_search");
      se->settings_modified = 0;
  
-     if (se->sorted_results) {
-         if (!reclist_sortparms_cmp(se->sorted_results, sp))
-             same_sort_order = 1;
-     }
      session_clear_set(se, sp);
      relevance_destroy(&se->relevance);
  
@@@ -1234,38 -1229,6 +1229,38 @@@ void show_single_stop(struct session *s
  }
  
  
 +int session_fetch_more(struct session *se)
 +{
 +    struct client_list *l;
 +    int ret = 0;
 +
 +    for (l = se->clients_active; l; l = l->next)
 +    {
 +        struct client *cl = l->client;
 +        if (client_get_state(cl) == Client_Idle)
 +        {
 +            if (client_fetch_more(cl))
 +            {
 +                session_log(se, YLOG_LOG, "%s: more to fetch",
 +                            client_get_id(cl));
 +                ret = 1;
 +            }
 +            else
 +            {
 +                session_log(se, YLOG_LOG, "%s: no more to fetch",
 +                            client_get_id(cl));
 +            }
 +        }
 +        else
 +        {
 +            session_log(se, YLOG_LOG, "%s: no fetch due to state=%s",
 +                        client_get_id(cl), client_get_state_str(cl));
 +        }
 +
 +    }
 +    return ret;
 +}
 +
  struct record_cluster **show_range_start(struct session *se,
                                           struct reclist_sortparms *sp,
                                           int start, int *num, int *total,
@@@ -1880,7 -1843,7 +1875,7 @@@ static int ingest_to_cluster(struct cli
      cluster = reclist_insert(se->reclist, service, record,
                               mergekey_norm, &se->total_merged);
      if (!cluster)
-         return -1;
+         return 0; // complete match with existing record
  
      {
          const char *use_term_factor_str =