Changeset 5141


Ignore:
Timestamp:
2003-08-18T11:08:54+12:00 (21 years ago)
Author:
kjdon
Message:

fixed a bug in teh phrase searching - if the index had been built on more than one metadata field, eg Title,Subject, it would try to look up Title,Subject in the info record, and wouldnt find an entry, so the phrase wouldn't be found, even though it was there in say the Title entry

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/colservr/phrasesearch.cpp

    r2937 r5141  
    233233
    234234  bool result = false;
    235   text_tarray *tarr_ptr = OID_info.getmultinfo (type);
    236   if (tarr_ptr != NULL ) {
    237     text_tarray::const_iterator subvalue_here = (*tarr_ptr).begin();
    238     text_tarray::const_iterator subvalue_end = (*tarr_ptr).end();
    239     while (subvalue_here != subvalue_end) {
    240       metadata = (to_utf8(*subvalue_here)).getcarr(metadata_len);
    241       result = doc_phrase_search ((unsigned char *)metadata, metadata_len, phrase);
    242       delete [] metadata;
    243 
    244       if (result) return true;
    245       subvalue_here++;
    246     }
    247   }
    248 
     235
     236  // need to look through all the metadata values in the index
     237  text_tarray keys;
     238  splitchar(type.begin(), type.end(), ',', keys);
     239
     240  text_tarray::const_iterator keyhere = keys.begin();
     241  text_tarray::const_iterator keyend = keys.end();
     242  while (keyhere != keyend) {
     243    text_tarray *tarr_ptr = OID_info.getmultinfo (*keyhere);
     244    if (tarr_ptr != NULL ) {
     245      text_tarray::const_iterator subvalue_here = (*tarr_ptr).begin();
     246      text_tarray::const_iterator subvalue_end = (*tarr_ptr).end();
     247      while (subvalue_here != subvalue_end) {
     248    metadata = (to_utf8(*subvalue_here)).getcarr(metadata_len);
     249    result = doc_phrase_search ((unsigned char *)metadata, metadata_len, phrase);
     250    delete [] metadata;
     251   
     252    if (result) return true;
     253    subvalue_here++;
     254      }
     255    }
     256    keyhere ++;
     257  }
    249258  return result;
    250259}
Note: See TracChangeset for help on using the changeset viewer.