mirror of
https://github.com/gigablast/open-source-search-engine.git
synced 2024-10-04 04:07:13 +03:00
fix a few bugs pertaining to tags.uri:"" fix
a while back.
This commit is contained in:
parent
15421908be
commit
2800ce0e04
@ -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 ( );
|
||||
|
30
Query.cpp
30
Query.cpp
@ -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
32
qa.cpp
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user