int m_resultset_ttl;
int m_resultset_max;
int m_session_ttl;
+ bool m_optimize_search;
};
}
}
BackendClassPtr bc = m_backend_class;
{
boost::mutex::scoped_lock lock(bc->m_mutex_backend_class);
- // look at each backend and see if we have a similar search
- BackendInstanceList::const_iterator it = bc->m_backend_list.begin();
- for (; it != bc->m_backend_list.end(); it++)
+ if (m_p->m_optimize_search)
{
- if (!(*it)->m_in_use)
+ // look at each backend and see if we have a similar search
+ BackendInstanceList::const_iterator it = bc->m_backend_list.begin();
+ for (; it != bc->m_backend_list.end(); it++)
{
- BackendSetList::const_iterator set_it = (*it)->m_sets.begin();
- for (; set_it != (*it)->m_sets.end(); set_it++)
+ if (!(*it)->m_in_use)
{
- if ((*set_it)->m_databases == databases
- && query.match(&(*set_it)->m_query))
+ BackendSetList::const_iterator set_it = (*it)->m_sets.begin();
+ for (; set_it != (*it)->m_sets.end(); set_it++)
{
- found_set = *set_it;
- found_backend = *it;
- bc->use_backend(found_backend);
- found_set->timestamp();
- // found matching set. No need to search again
- return;
+ if ((*set_it)->m_databases == databases
+ && query.match(&(*set_it)->m_query))
+ {
+ found_set = *set_it;
+ found_backend = *it;
+ bc->use_backend(found_backend);
+ found_set->timestamp();
+ // found matching set. No need to search again
+ return;
+ }
}
}
}
m_resultset_ttl = 30;
m_resultset_max = 10;
m_session_ttl = 90;
+ m_optimize_search = true;
}
void yf::SessionShared::Rep::start()
m_p->m_resultset_max =
mp::xml::get_int(attr->children, 10);
}
+ else if (!strcmp((const char *) attr->name, "optimizesearch"))
+ {
+ m_p->m_optimize_search =
+ mp::xml::get_bool(attr->children, true);
+ }
else
throw mp::filter::FilterException(
"Bad attribute " + std::string((const char *)
attribute name { xsd:NCName }?,
element mp:resultset {
attribute max { xsd:integer },
- attribute ttl { xsd:integer }
+ attribute ttl { xsd:integer },
+ attribute optimizesearch { xsd:boolean }
}?,
element mp:session {
attribute ttl { xsd:integer }