fix avail docid logic some more for indexing

spdier replies
This commit is contained in:
Matt Wells 2014-05-13 21:27:05 -07:00
parent 015b9d4597
commit 88eb44827f
2 changed files with 23 additions and 7 deletions

View File

@ -296,7 +296,7 @@ void Msg22::gotReply ( ) {
m_found = false;
// get docid provided
long long d = *(long long *)reply;
// this is -1 if none available
// this is -1 or 0 if none available
m_availDocId = d;
// nuke the reply
mfree ( reply , maxSize , "Msg22");
@ -311,6 +311,11 @@ void Msg22::gotReply ( ) {
m_callback ( m_state );
return;
}
// sanity check. must either be an empty reply indicating nothing
// available or an 8 byte reply above!
if ( m_r->m_getAvailDocIdOnly ) { char *xx=NULL;*xx=0; }
// otherwise, it was found
m_found = true;
@ -909,6 +914,7 @@ void gotTitleList ( void *state , RdbList *list , Msg5 *msg5 ) {
// make sure our available docids are availble!
if ( dd == ad1 ) ad1++;
if ( dd == ad2 ) ad2++;
continue;
}
// if we had a url make sure uh48 matches
else if ( r->m_url[0] ) {
@ -932,7 +938,7 @@ void gotTitleList ( void *state , RdbList *list , Msg5 *msg5 ) {
docIdWasFound = true;
// do not set back titlerec if just want avail docid
if ( r->m_getAvailDocIdOnly ) continue;
//if ( r->m_getAvailDocIdOnly ) continue;
// ok, if just "checking tfndb" no need to go further
if ( r->m_justCheckTfndb ) {
@ -978,10 +984,12 @@ void gotTitleList ( void *state , RdbList *list , Msg5 *msg5 ) {
if ( ad == 0LL ) ad = ad1;
// if "docId" was unmatched that should be the preferred available
// docid then...
if ( ! docIdWasFound && r->m_getAvailDocIdOnly && ad != r->m_docId ) {
char *xx=NULL;*xx=0; }
// remember it
//if(! docIdWasFound && r->m_getAvailDocIdOnly && ad != r->m_docId ) {
// char *xx=NULL;*xx=0; }
// remember it. this might be zero if none exist!
st->m_availDocId = ad;
// note it
if ( ad == 0LL ) log("msg22: avail docid is 0 for pd=%lli!",pd);
// . ok, return an available docid

View File

@ -10473,6 +10473,7 @@ long long *XmlDoc::getAvailDocIdOnly ( long long preferredDocId ) {
return NULL;
}
if ( m_availDocIdValid )
// this is 0 or -1 if no avail docid was found
return &m_msg22c.m_availDocId;
CollectionRec *cr = getCollRec();
if ( ! cr ) return NULL;
@ -25059,12 +25060,19 @@ SafeBuf *XmlDoc::getSpiderReplyMetaList2 ( SpiderReply *reply ) {
// try to get an available docid, preferring "d" if available
long long *uqd = getAvailDocIdOnly ( d );
if ( ! uqd || uqd == (void *)-1 ) return (SafeBuf *)uqd;
// sanity
if ( *uqd <= 0 || *uqd > MAX_DOCID ) { char *xx=NULL;*xx=0; }
// reset just in case
m_spiderReplyMetaList.reset();
// sanity
if ( *uqd <= 0 || *uqd > MAX_DOCID ) {
log("xmldoc: avail docid = %lli. could not index spider "
"reply or %s",*uqd,m_firstUrl.m_url);
//char *xx=NULL;*xx=0; }
m_spiderReplyMetaListValid = true;
return &m_spiderReplyMetaList;
}
// the posdb table
HashTableX tt4;
if ( !tt4.set(18,4,256,NULL,0,false,m_niceness,"posdb-spindx"))