~ubuntu-branches/ubuntu/trusty/swish-e/trusty

« back to all changes in this revision

Viewing changes to src/merge.c

  • Committer: Bazaar Package Importer
  • Author(s): Ludovic Drolez
  • Date: 2008-09-25 21:52:31 UTC
  • mfrom: (4.1.4 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080925215231-vk46pq42o533syg2
Tags: 2.4.5-5
swish.cgi was not working. Fixed with a 1 char patch. Closes: #500154

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
** This program and library is free software; you can redistribute it and/or
3
 
** modify it under the terms of the GNU General Public License
4
 
** as published by the Free Software Foundation; either version 2
5
 
** of the License, or any later version.
6
 
**
7
 
** This program is distributed in the hope that it will be useful,
8
 
** but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
 
** GNU (Library) General Public License for more details.
11
 
**
12
 
** You should have received a copy of the GNU (Library) General Public License
13
 
** along with this program; if not, write to the Free Software
14
 
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
2
 
 
3
$Id: merge.c,v 1.94 2005/05/12 15:41:05 karman Exp $
 
4
 
 
5
 
 
6
    This file is part of Swish-e.
 
7
 
 
8
    Swish-e is free software; you can redistribute it and/or modify
 
9
    it under the terms of the GNU General Public License as published by
 
10
    the Free Software Foundation; either version 2 of the License, or
 
11
    (at your option) any later version.
 
12
 
 
13
    Swish-e is distributed in the hope that it will be useful,
 
14
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
    GNU General Public License for more details.
 
17
 
 
18
    You should have received a copy of the GNU General Public License
 
19
    along  with Swish-e; if not, write to the Free Software
 
20
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
21
    
 
22
    See the COPYING file that accompanies the Swish-e distribution for details
 
23
    of the GNU GPL and the special exception available for linking against
 
24
    the Swish-e library.
 
25
    
 
26
** Mon May  9 15:07:32 CDT 2005
 
27
** added GPL
 
28
    
15
29
**-----------------------------------------------------------------
16
30
**
17
31
**  rewritten from scratch - moseley Oct 17, 2001
368
382
    read_header(sw_input, out_header, sw_input->indexlist->DB);
369
383
 
370
384
    out_header->totalfiles = 0;
 
385
 
 
386
    /* $$$ This needs to be fixed */
371
387
    out_header->removedfiles = 0;
 
388
    out_header->removed_word_positions = 0;
372
389
    out_header->totalwords = 0;
373
390
 
374
391
    freeMetaEntries( out_header );
579
596
*
580
597
*****************************************************************************/
581
598
 
582
 
static int  *sorted_data;
 
599
static int  *sorted_data;  /* Static array to make the qsort function a bit quicker */
583
600
 
584
601
static int     compnums(const void *s1, const void *s2)
585
602
{
598
615
    return 0;
599
616
}
600
617
 
 
618
/******************************************************************************
 
619
* load_filename_sort -
 
620
*
 
621
*   Creates an array used for sorting file names.
 
622
*   Uses the pre-sorted array, if available, otherwise, creates one.
 
623
*
 
624
*******************************************************************************/
601
625
 
602
626
static void load_filename_sort( SWISH *sw, IndexFILE *cur_index )
603
627
{
621
645
    cur_index->modified_meta = getPropNameByName( &cur_index->header, AUTOPROPERTY_LASTMODIFIED );
622
646
 
623
647
 
 
648
    /*
 
649
     * Since USE_PRESORT_ARRAY has a different internal format that what is generated
 
650
     * by CreatePropeSortArray() we must ALWAYS create an actual integer
 
651
     * array total_files long.
 
652
     * 
 
653
     * $$$ The problem is that with USE_PRESORT_ARRAY the format is different
 
654
     *     before and after saving the array to disk
 
655
     */
 
656
 
 
657
#ifdef USE_PRESORT_ARRAY
 
658
    if ( 1 )
 
659
#else
624
660
    if ( !LoadSortedProps( cur_index, path_meta ) )
 
661
#endif
 
662
 
625
663
    {
626
664
        FileRec fi;
627
665
        memset( &fi, 0, sizeof( FileRec ));
650
688
 
651
689
    cur_index->path_order = sort_array;
652
690
 
 
691
    /* $$$ can this be freeded when using BTREE??? */
653
692
    efree( path_meta->sorted_data );
654
693
    path_meta->sorted_data = NULL;
655
694
}