fix a few bugs pertaining to tags.uri:"" fix

a while back.
This commit is contained in:
mwells 2014-08-25 12:40:51 -07:00
parent 15421908be
commit 2800ce0e04
3 changed files with 61 additions and 4 deletions

View File

@ -573,7 +573,8 @@ bool processLoop ( void *state ) {
CollectionRec *cr = xd->getCollRec();
if ( xd && cr && cr->m_coll && !strcmp(cr->m_coll,"qatest123"))
// use same dir that XmlDoc::getTestDir() would use
saveTestBuf ( "test-page-parser" );
//saveTestBuf ( "test-page-parser" );
saveTestBuf("qa");
// now get the meta list, in the process it will print out a
// bunch of junk into st->m_xbuf
char *metalist = xd->getMetaList ( );

View File

@ -683,9 +683,12 @@ bool Query::setQTerms ( Words &words , Phrases &phrases ) {
// if ( qw->m_ignoreWord ) continue;
// ignore if in quotes
if ( qw->m_quoteStart >= 0 ) continue;
//if ( qw->m_quoteStart >= 0 ) continue;
// ignore if in quotes and part of phrase, watch out
// for things like "word", a single word in quotes.
if ( qw->m_quoteStart >= 0 && qw->m_phraseId ) continue;
// if nore if weight is absolute zero
// ignore if weight is absolute zero
if ( qw->m_userWeight == 0 &&
qw->m_userType == 'a' ) continue;
@ -2413,6 +2416,29 @@ bool Query::setQWords ( char boolFlag ,
// and also the floating point after that
qw->m_float = atof ( w + lastColonLen + 1 );
qw->m_int = (long)atoll( w + lastColonLen+1);
// if it is like
// gbequalint:tag.uri:"http://xyz.com/poo"
// then we should hash the string into
// an int just like how the field value would
// be hashed when adding gbequalint: terms
// in XmlDoc.cpp:hashFacet2(). the hash of
// the tag.uri field, for example, is set
// in hashFacet1() and set to "val32". so
// hash it just like that does here.
if ( colonCount >= 1 &&
fieldCode == FIELD_GBNUMBEREQUALINT &&
firstColonLen > 0 &&
wlen>3 && // something must be in the ""'s
w[wlen-1] == '\"' &&
w[firstColonLen] == ':' &&
w[firstColonLen+1] == '\"' ) {
// . skip over colon at start
// . skip over quotes at start/end
char *a = w + firstColonLen + 2;
char *b = w + wlen - 1;
qw->m_int = hash32 ( a , b - a );
qw->m_float = (float)qw->m_int;
}
}

32
qa.cpp
View File

@ -1518,9 +1518,39 @@ bool qajson ( ) {
}
//static bool s_fee2 = false;
// test gbequalint:field:"quoted value" query to ensure it converts
// the quoted value into the right int32
if ( ! s_flags[11] ) {
s_flags[11] = true;
if ( ! getUrl ( "/search?c=qatest123&qa=1&format=json&"
"q=gbequalint%3AAstrings.key%3A\"samsung\"",
-1310551262 ) )
return false;
}
// other query tests...
if ( ! s_flags[12] ) {
s_flags[12] = true;
if ( ! getUrl ( "/search?c=qatest123&qa=1&format=json&"
"q=inurl2%3Aquirksmode.org%2Fm%2F",
-1310551262 ) )
return false;
}
if ( ! s_flags[13] ) {
s_flags[13] = true;
if ( ! getUrl ( "/search?c=qatest123&qa=1&format=json&"
"q=site%3Aquirksmode.org",
-1310551262 ) )
return false;
}
//static bool s_fee2 = false;
if ( ! s_flags[20] ) {
s_flags[20] = true;
log("qa: SUCCESSFULLY COMPLETED "
"QA JSON TEST");
return true;