X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=src%2Frelevance.c;h=92f51a88b3c38cc4a1821d1ecea51b192bde557c;hb=75027807cf88b7c47320c0ec051084c0a0188da6;hp=a11c0533b75aa15eccbe9cf38dec30c98e481580;hpb=bdf63c9b34f8a40edec11d50dc71454c0b8daf32;p=pazpar2-moved-to-github.git diff --git a/src/relevance.c b/src/relevance.c index a11c053..92f51a8 100644 --- a/src/relevance.c +++ b/src/relevance.c @@ -1,5 +1,22 @@ -/* - * $Id: relevance.c,v 1.7 2007-01-10 10:04:23 adam Exp $ +/* $Id: relevance.c,v 1.10 2007-04-16 13:54:55 marc Exp $ + Copyright (c) 2006-2007, Index Data. + +This file is part of Pazpar2. + +Pazpar2 is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +Pazpar2 is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Pazpar2; see the file LICENSE. If not, write to the +Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ #include @@ -46,6 +63,7 @@ static struct word_trie *create_word_trie_node(NMEM nmem) static void word_trie_addterm(NMEM nmem, struct word_trie *n, const char *term, int num) { + while (*term) { int c = tolower(*term); if (c < 'a' || c > 'z') @@ -177,6 +195,7 @@ void relevance_donerecord(struct relevance *r, struct record_cluster *cluster) r->doc_frequency_vec[0]++; } +#ifdef GAGA #ifdef FLOAT_REL static int comp(const void *p1, const void *p2) { @@ -199,8 +218,9 @@ static int comp(const void *p1, const void *p2) return (*r2)->relevance - (*r1)->relevance; } #endif +#endif -// Prepare for a relevance-sorted read of up to num entries +// Prepare for a relevance-sorted read void relevance_prepare_read(struct relevance *rel, struct reclist *reclist) { int i; @@ -231,7 +251,9 @@ void relevance_prepare_read(struct relevance *rel, struct reclist *reclist) } rec->relevance = (int) (relevance * 100000); } +#ifdef GAGA qsort(reclist->flatlist, reclist->num_records, sizeof(struct record*), comp); +#endif reclist->pointer = 0; xfree(idfvec); }