Changeset 10412


Ignore:
Timestamp:
2005-08-04T09:44:00+12:00 (19 years ago)
Author:
mdewsnip
Message:

Now escapes quotes so phrase searches with Lucene work.

File:
1 edited

Legend:

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

    r9937 r10412  
    115115    defaultBoolCombine = 1;
    116116  }
    117   char* utf8querystring=to_utf8(queryparams.querystring).getcstr();
     117
     118  text_t utf8querystring = to_utf8(queryparams.querystring);
    118119  cerr << "**** query string = " << utf8querystring << endl;
     120
     121  text_t escaped_utf8querystring = "";
     122  text_t::const_iterator here = utf8querystring.begin();
     123  while (here != utf8querystring.end()) {
     124    if (*here == '"') escaped_utf8querystring.push_back('\\');
     125    escaped_utf8querystring.push_back(*here);
     126    here++;
     127  }
     128  cerr << "**** escaped query string = " << escaped_utf8querystring << endl;
    119129  cerr << "***** index name = " << indexname << endl;
    120130
    121131  text_t cmd = "lucene_query.pl ";
    122   cmd += (text_t)" \""+indexname + (text_t)"\" \"" + to_utf8(queryparams.querystring) + (text_t)"\"";
     132  cmd += (text_t)" \""+indexname + (text_t)"\" \"" + escaped_utf8querystring + (text_t)"\"";
     133  cerr << "Lucene command: " << cmd << endl;
    123134 
    124135  text_t xml_text = "";
Note: See TracChangeset for help on using the changeset viewer.