# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1283452652 -10800 # Node ID 3e1f76dd2722094006fb68c291d4b93e29f23039 # Parent cf5c74390b98dcebd21b78a751721bdc4a6a40bf Revision: 201033 Kit: 201035 diff -r cf5c74390b98 -r 3e1f76dd2722 harvester/harvesterserver/src/ccontentinfodb.cpp --- a/harvester/harvesterserver/src/ccontentinfodb.cpp Wed Aug 18 10:53:26 2010 +0300 +++ b/harvester/harvesterserver/src/ccontentinfodb.cpp Thu Sep 02 21:37:32 2010 +0300 @@ -266,9 +266,12 @@ sql.Format( KCISqlFormatSeek, &aContentName ); RSqlStatement stmt; - stmt.Prepare( iDatabase , sql ); - - TBool isfound = ( KSqlAtRow == stmt.Next() )?ETrue:EFalse; + TBool isfound = EFalse; + //Error check necessary to avoid sqldb 2 panic, + //if sqlstatement preparation fails, call to Next() raises this panic + TInt err = stmt.Prepare( iDatabase , sql ); + if ( err == KErrNone) + isfound = ( KSqlAtRow == stmt.Next() )?ETrue:EFalse; OstTraceFunctionExit0( CCONTENTINFODB_FINDL_EXIT ); return isfound; } @@ -290,11 +293,14 @@ sql.Copy( KSelectAllRowsFormat ); RSqlStatement stmt; - stmt.Prepare( iDatabase , sql ); - - while ( KSqlAtEnd != stmt.Next() ) - ++count; - + TInt err = stmt.Prepare( iDatabase , sql ); + //Error check necessary to avoid sqldb 2 panic, + //if sqlstatement preparation fails, call to Next() raises this panic + if( err == KErrNone) + { + while ( KSqlAtEnd != stmt.Next() ) + ++count; + } OstTraceFunctionExit0( CCONTENTINFODB_GETCONTENTCOUNTL_EXIT ); return count; } diff -r cf5c74390b98 -r 3e1f76dd2722 qcpix/src/platform/s60/inc/cpixdocumentprivate.h --- a/qcpix/src/platform/s60/inc/cpixdocumentprivate.h Wed Aug 18 10:53:26 2010 +0300 +++ b/qcpix/src/platform/s60/inc/cpixdocumentprivate.h Thu Sep 02 21:37:32 2010 +0300 @@ -32,6 +32,14 @@ QString iExcerpt; QString iBaseAppClass; QList< CpixDocumentField* > iFields; + + CpixDocumentPrivate::~CpixDocumentPrivate() + { + for (int i =0; i< iFields.count();i++) + { + delete iFields.at(i); + } + } }; #endif //_CPIXDOCUMENTPVTIMPL_H diff -r cf5c74390b98 -r 3e1f76dd2722 qcpix/src/platform/s60/src/cpixutils.cpp --- a/qcpix/src/platform/s60/src/cpixutils.cpp Wed Aug 18 10:53:26 2010 +0300 +++ b/qcpix/src/platform/s60/src/cpixutils.cpp Thu Sep 02 21:37:32 2010 +0300 @@ -46,26 +46,30 @@ CpixDocument** CpixBatchDocFromCSearchDocument( TInt aReturnDoc, CSearchDocument** aDoc ) { - if( aDoc == NULL ) return NULL; + if( aDoc == NULL || !aReturnDoc ) return NULL; CpixDocument** cpixBatchDocs = NULL; cpixBatchDocs = (CpixDocument**)malloc ( sizeof(CpixDocument*) * (aReturnDoc)); for (int count = 0; count < aReturnDoc; count++) { CpixDocument* cpixDoc = CpixDocument::newInstance(); - cpixDoc->setBaseAppClass( QStringFromDescriptor( aDoc[count]->AppClass() ) ); - cpixDoc->setDocId( QStringFromDescriptor( aDoc[count]->Id() ) ); - cpixDoc->setExcerpt( QStringFromDescriptor( aDoc[count]->Excerpt() ) ); - - int fieldCount = aDoc[count]->FieldCount(); - for( int i=0; i< fieldCount; i++ ) + if ( cpixDoc ) { - const CDocumentField& field = aDoc[count]->Field( i ); - cpixDoc->addField( QStringFromDescriptor( field.Name() ), QStringFromDescriptor( field.Value() ), field.Config() ); + cpixDoc->setBaseAppClass( QStringFromDescriptor( aDoc[count]->AppClass() ) ); + cpixDoc->setDocId( QStringFromDescriptor( aDoc[count]->Id() ) ); + cpixDoc->setExcerpt( QStringFromDescriptor( aDoc[count]->Excerpt() ) ); + + int fieldCount = aDoc[count]->FieldCount(); + for( int i=0; i< fieldCount; i++ ) + { + const CDocumentField& field = aDoc[count]->Field( i ); + cpixDoc->addField( QStringFromDescriptor( field.Name() ), QStringFromDescriptor( field.Value() ), field.Config() ); + } } cpixBatchDocs[count]= cpixDoc; delete aDoc[count]; aDoc[count] = NULL; } delete aDoc; + aDoc = NULL; return cpixBatchDocs; } diff -r cf5c74390b98 -r 3e1f76dd2722 rom/cpix_mw.iby --- a/rom/cpix_mw.iby Wed Aug 18 10:53:26 2010 +0300 +++ b/rom/cpix_mw.iby Thu Sep 02 21:37:32 2010 +0300 @@ -59,6 +59,7 @@ data=ZSYSTEM\install\cpixsearch_stub.sis System\Install\cpixsearch_stub.sis data=DATAZ_\private\10202be9\2001f6fb.cre private\10202be9\2001f6fb.cre +data=DATAZ_\private\10202be9\20029AB8.cre private\10202be9\20029AB8.cre #endif //FF_SEARCH_SW diff -r cf5c74390b98 -r 3e1f76dd2722 searchengine/cpix/cpix/inc/public/appclass-hierarchy.txt --- a/searchengine/cpix/cpix/inc/public/appclass-hierarchy.txt Wed Aug 18 10:53:26 2010 +0300 +++ b/searchengine/cpix/cpix/inc/public/appclass-hierarchy.txt Thu Sep 02 21:37:32 2010 +0300 @@ -124,6 +124,7 @@ /* The order of fields in excerpt is as below. The order in this case * is the order of fields shown when you 'Edit' the contact. */ + | [ IsGroup ] {EStoreYes | EIndexNo} | [ GivenName ] {EStoreYes | EIndexTokenized | EIndexFreeText} {ExcerptNo} | [ FamilyName ] {EStoreYes | EIndexTokenized | EIndexFreeText} {ExcerptNo} | [ PhoneNumber ] {EStoreYes | EIndexTokenized} {ExcerptYes} diff -r cf5c74390b98 -r 3e1f76dd2722 searchengine/cpix/cpix/src/prefixqueryparser.cpp --- a/searchengine/cpix/cpix/src/prefixqueryparser.cpp Wed Aug 18 10:53:26 2010 +0300 +++ b/searchengine/cpix/cpix/src/prefixqueryparser.cpp Thu Sep 02 21:37:32 2010 +0300 @@ -60,7 +60,7 @@ void add(auto_ptr q) { if ( q.get() ) { if ( bq_ ) { - bq_->add( q.release(), true, true, false ); + bq_->add( q.release(), true, false, false ); } else { if ( q_.get() ) { auto_ptr bq( new BooleanQuery() ); diff -r cf5c74390b98 -r 3e1f76dd2722 searchengine/oss/cl/clucene/src/clucene/analysis/standard/standardtokenizer.cpp --- a/searchengine/oss/cl/clucene/src/clucene/analysis/standard/standardtokenizer.cpp Wed Aug 18 10:53:26 2010 +0300 +++ b/searchengine/oss/cl/clucene/src/clucene/analysis/standard/standardtokenizer.cpp Thu Sep 02 21:37:32 2010 +0300 @@ -267,9 +267,9 @@ CONSUME_WORD; if (!EOS && str.len < LUCENE_MAX_WORD_LEN-1 ) { //still have space for 1 more character? switch(ch) { /* What follows the first alphanum segment? */ - case '.': - str.appendChar('.'); - return ReadDotted(&str, CL_NS2(analysis,standard)::UNKNOWN,t); +// case '.': +// str.appendChar('.'); +// return ReadDotted(&str, CL_NS2(analysis,standard)::UNKNOWN,t); case '\'': str.appendChar('\''); return ReadApostrophe(&str,t); diff -r cf5c74390b98 -r 3e1f76dd2722 searchengine/oss/cl/clucene/src/clucene/search/hits.cpp --- a/searchengine/oss/cl/clucene/src/clucene/search/hits.cpp Wed Aug 18 10:53:26 2010 +0300 +++ b/searchengine/oss/cl/clucene/src/clucene/search/hits.cpp Thu Sep 02 21:37:32 2010 +0300 @@ -12,11 +12,17 @@ #include "filter.h" #include "clucene/search/searchheader.h" //#ifdef USE_HIGHLIGHTER -//#include "CLucene/highlighter/QueryTermExtractor.h" -//#include "CLucene/highlighter/QueryScorer.h" -//#include "CLucene/highlighter/Highlighter.h" -//#include "CLucene/highlighter/SimpleHTMLFormatter.h" -//#include "CLucene/analysis/standard/StandardAnalyzer.h" + +#include "CLucene/highlighter/QueryTermExtractor.h" +#include "CLucene/highlighter/QueryScorer.h" +#include "CLucene/highlighter/Highlighter.h" +#include "CLucene/highlighter/SimpleHTMLFormatter.h" +#include "CLucene/analysis/standard/StandardAnalyzer.h" +#include "clucene/search/prefixquery.h" + +// internal libs +#include "cpixparsetools.h" + //#endif CL_NS_USE(document) @@ -50,7 +56,7 @@ Hits::Hits(Searcher* s, Query* q, Filter* f, const Sort* _sort): query(q), searcher(s), filter(f), sort(_sort) //#ifdef USE_HIGHLIGHTER -// , hl_frag(20) + , hl_frag(20) //#endif { //Func - Constructor @@ -94,40 +100,71 @@ hitDoc->doc = _CLNEW Document; searcher->doc(hitDoc->id, hitDoc->doc); // cache miss: read document //#ifdef USE_HIGHLIGHTER -// CL_NS(document)::Document* document = hitDoc->doc; -// -// const TCHAR* text = document->get(LCPIX_EXCERPT_FIELD); -// -// if(text) -// { -// Query* rwquery = searcher->getrewritten(hitDoc->id, query); -// -// TCHAR * str = rwquery->toString(); -// -// CL_NS2(search,highlight)::QueryScorer hl_scorer(rwquery); -// -// CL_NS2(search,highlight)::Highlighter highlighter(&hl_formatter, &hl_scorer); -// -// highlighter.setTextFragmenter(&hl_frag); -// -// wstring hlText; -// -// StringReader strreader(text); -// -// lucene::analysis::TokenStream * tokenStream = hl_analyzer.tokenStream(LCPIX_EXCERPT_FIELD, &strreader); -// -// TCHAR* result = highlighter.getBestFragments(tokenStream, text, 2,L"..."); -// -// if (result != NULL) -// { -// hlText.append(result); -// -// document->removeField( LCPIX_EXCERPT_FIELD ); -// -// document->add(*_CLNEW Field(LCPIX_EXCERPT_FIELD, -// hlText.c_str(), lucene::document::Field::STORE_YES | lucene::document::Field::INDEX_NO)); -// } -// } + + CL_NS(document)::Document* document = hitDoc->doc; + + TCHAR* result = NULL; + Query* rwquery[2]; + searcher->getrewritten(hitDoc->id, query, rwquery); + + const TCHAR* firstlnHLtxt = document->get(LCPIX_HL_EXCERPT_FIELD); + + if(firstlnHLtxt && rwquery[1]) + { + CL_NS2(search,highlight)::QueryScorer hl_scorer(rwquery[1]); + + CL_NS2(search,highlight)::Highlighter highlighter(&hl_formatter, &hl_scorer); + + highlighter.setTextFragmenter(&hl_frag); + + wstring hlText; + + StringReader strreader(firstlnHLtxt); + + lucene::analysis::TokenStream * tokenStream = hl_analyzer.tokenStream(LCPIX_HL_EXCERPT_FIELD, &strreader); + + result = highlighter.getBestFragments(tokenStream, firstlnHLtxt, 2,L"..."); + + if (result != NULL && *((int*)result) != 0x00) + { + hlText.append(result); + + document->removeField( LCPIX_HL_EXCERPT_FIELD ); + + document->add(*_CLNEW Field(LCPIX_HL_EXCERPT_FIELD, + hlText.c_str(), lucene::document::Field::STORE_YES | lucene::document::Field::INDEX_NO)); + } + + } + + const TCHAR* text = document->get(LCPIX_EXCERPT_FIELD); + + if(text && rwquery[1]) + { + CL_NS2(search,highlight)::QueryScorer hl_scorer(rwquery[1]); + + CL_NS2(search,highlight)::Highlighter highlighter(&hl_formatter, &hl_scorer); + + highlighter.setTextFragmenter(&hl_frag); + + wstring hlText; + + StringReader strreader(text); + + lucene::analysis::TokenStream * tokenStream = hl_analyzer.tokenStream(LCPIX_EXCERPT_FIELD, &strreader); + + result = highlighter.getBestFragments(tokenStream, text, 2,L"..."); + + if (result != NULL && *((int*)result) != 0x00) + { + hlText.append(result); + + document->removeField( LCPIX_EXCERPT_FIELD ); + + document->add(*_CLNEW Field(LCPIX_EXCERPT_FIELD, + hlText.c_str(), lucene::document::Field::STORE_YES | lucene::document::Field::INDEX_NO)); + } + } //#endif } diff -r cf5c74390b98 -r 3e1f76dd2722 searchengine/oss/cl/clucene/src/clucene/search/indexsearcher.cpp --- a/searchengine/oss/cl/clucene/src/clucene/search/indexsearcher.cpp Wed Aug 18 10:53:26 2010 +0300 +++ b/searchengine/oss/cl/clucene/src/clucene/search/indexsearcher.cpp Thu Sep 02 21:37:32 2010 +0300 @@ -17,12 +17,12 @@ #include "clucene/util/bitset.h" #include "fieldsortedhitqueue.h" //#ifdef USE_HIGHLIGHTER -//#include "CLucene/highlighter/QueryTermExtractor.h" -//#include "CLucene/highlighter/QueryScorer.h" -//#include "CLucene/highlighter/Highlighter.h" -//#include "CLucene/highlighter/SimpleHTMLFormatter.h" -//#include "CLucene/analysis/standard/StandardAnalyzer.h" -//#include "CLucene/queryParser/QueryParser.h" +#include "CLucene/highlighter/QueryTermExtractor.h" +#include "CLucene/highlighter/QueryScorer.h" +#include "CLucene/highlighter/Highlighter.h" +#include "CLucene/highlighter/SimpleHTMLFormatter.h" +#include "CLucene/analysis/standard/StandardAnalyzer.h" +#include "CLucene/queryParser/QueryParser.h" //#endif CL_NS_USE(index) CL_NS_USE(util) @@ -120,7 +120,8 @@ reader = IndexReader::open(path); readerOwner = true; //#ifdef USE_HIGHLIGHTER -// rewrittenQuery = NULL; + fistlnHLQuery = NULL; + excerptrwQuery = NULL; //#endif } @@ -136,7 +137,8 @@ reader = IndexReader::open(directory); readerOwner = true; //#ifdef USE_HIGHLIGHTER -// rewrittenQuery = NULL; + fistlnHLQuery = NULL; + excerptrwQuery = NULL; //#endif } @@ -150,7 +152,8 @@ reader = r; readerOwner = false; //#ifdef USE_HIGHLIGHTER -// rewrittenQuery = NULL; + fistlnHLQuery = NULL; + excerptrwQuery = NULL; //#endif } @@ -218,15 +221,14 @@ //Func - //Pre - reader != NULL //Post - -//#ifdef USE_HIGHLIGHTER -// if(!rewrittenQuery) -// { -// rewrittenQuery = query->rewrite(reader); -// } -//#endif - CND_PRECONDITION(reader != NULL, "reader is NULL"); CND_PRECONDITION(query != NULL, "query is NULL"); +//#ifdef USE_HIGHLIGHTER + if(!excerptrwQuery || !fistlnHLQuery) + { + excerptrwQuery = query->rewrite(reader); + } +//#endif Weight* weight = query->weight(this); Scorer* scorer = weight->scorer(reader); @@ -271,15 +273,18 @@ // inherit javadoc TopFieldDocs* IndexSearcher::_search(Query* query, Filter* filter, const int32_t nDocs, const Sort* sort) { -//#ifdef USE_HIGHLIGHTER -// if(!rewrittenQuery) -// { -// rewrittenQuery = query->rewrite(reader); -// } -//#endif + + CND_PRECONDITION(reader != NULL, "reader is NULL"); CND_PRECONDITION(query != NULL, "query is NULL"); +//#ifdef USE_HIGHLIGHTER + if(!excerptrwQuery || !fistlnHLQuery) + { + excerptrwQuery = query->rewrite(reader); + } +//#endif + Weight* weight = query->weight(this); Scorer* scorer = weight->scorer(reader); if (scorer == NULL){ @@ -324,14 +329,17 @@ // filter may or may not be NULL // results is a valid reference to a HitCollector and used to store the results //Post - filter if non-NULL, a bitset used to eliminate some documents -//#ifdef USE_HIGHLIGHTER -// if(!rewrittenQuery) -// { -// rewrittenQuery = query->rewrite(reader); -// } -//#endif + CND_PRECONDITION(reader != NULL, "reader is NULL"); CND_PRECONDITION(query != NULL, "query is NULL"); + +//#ifdef USE_HIGHLIGHTER + if(!excerptrwQuery || !fistlnHLQuery) + { + excerptrwQuery = query->rewrite(reader); + } +//#endif + BitSet* bits = NULL; SimpleFilteredCollector* fc = NULL; @@ -373,14 +381,11 @@ return query; } //#ifdef USE_HIGHLIGHTER -//Query* IndexSearcher::getrewritten(int32_t n, Query* original) -// { -// if(!rewrittenQuery) -// { -// rewrittenQuery = original->rewrite(reader); -// } -// return rewrittenQuery; -// } +void IndexSearcher::getrewritten(int32_t n, Query* original, Query* rwQuery[]) + { + rwQuery[0] = fistlnHLQuery; + rwQuery[1] = excerptrwQuery; + } //#endif void IndexSearcher::explain(Query* query, int32_t doc, Explanation* ret){ Weight* weight = query->weight(this); diff -r cf5c74390b98 -r 3e1f76dd2722 searchengine/oss/cl/clucene/src/clucene/search/indexsearcher.h --- a/searchengine/oss/cl/clucene/src/clucene/search/indexsearcher.h Wed Aug 18 10:53:26 2010 +0300 +++ b/searchengine/oss/cl/clucene/src/clucene/search/indexsearcher.h Thu Sep 02 21:37:32 2010 +0300 @@ -30,7 +30,9 @@ CL_NS(index)::IndexReader* reader; bool readerOwner; //#ifdef USE_HIGHLIGHTER -// Query *rewrittenQuery; + Query *fistlnHLQuery; + Query *excerptrwQuery; + CL_NS2(analysis,standard)::StandardAnalyzer hl_analyzer; //#endif public: /// Creates a searcher searching the index in the named directory. @@ -64,8 +66,9 @@ } Query* rewrite(Query* original); -///#ifdef USE_HIGHLIGHTER -// Query* getrewritten(int32_t n, Query* original); + +//#ifdef USE_HIGHLIGHTER + void getrewritten(int32_t n, Query* original, Query* rwQuery[]); //#endif void explain(Query* query, int32_t doc, Explanation* ret); }; diff -r cf5c74390b98 -r 3e1f76dd2722 searchengine/oss/cl/clucene/src/clucene/search/multisearcher.cpp --- a/searchengine/oss/cl/clucene/src/clucene/search/multisearcher.cpp Wed Aug 18 10:53:26 2010 +0300 +++ b/searchengine/oss/cl/clucene/src/clucene/search/multisearcher.cpp Thu Sep 02 21:37:32 2010 +0300 @@ -64,11 +64,11 @@ } //#ifdef USE_HIGHLIGHTER -// Query* MultiSearcher::getrewritten(int32_t n, Query* original) { -// int32_t i = subSearcher(n); // find searcher index -// // changed to get already rewritten query -// return searchables[i]->getrewritten(n, original); -// } + void MultiSearcher::getrewritten(int32_t n, Query* original, Query* rwQuery[]) { + int32_t i = subSearcher(n); // find searcher index + // changed to get already rewritten query + searchables[i]->getrewritten(n, original, rwQuery); + } //#endif int32_t MultiSearcher::searcherIndex(int32_t n) const{ diff -r cf5c74390b98 -r 3e1f76dd2722 searchengine/oss/cl/clucene/src/clucene/search/multisearcher.h --- a/searchengine/oss/cl/clucene/src/clucene/search/multisearcher.h Wed Aug 18 10:53:26 2010 +0300 +++ b/searchengine/oss/cl/clucene/src/clucene/search/multisearcher.h Thu Sep 02 21:37:32 2010 +0300 @@ -89,7 +89,7 @@ Query* rewrite(Query* original); //#ifdef USE_HIGHLIGHTER -// Query* getrewritten(int32_t n, Query* original); + void getrewritten(int32_t n, Query* original, Query* rwQuery[]); //#endif void explain(Query* query, int32_t doc, Explanation* ret); }; diff -r cf5c74390b98 -r 3e1f76dd2722 searchengine/oss/cl/clucene/src/clucene/search/searchheader.h --- a/searchengine/oss/cl/clucene/src/clucene/search/searchheader.h Wed Aug 18 10:53:26 2010 +0300 +++ b/searchengine/oss/cl/clucene/src/clucene/search/searchheader.h Thu Sep 02 21:37:32 2010 +0300 @@ -21,11 +21,12 @@ #include "clucene/search/similarity.h" //#ifdef USE_HIGHLIGHTER -//#include "CLucene/highlighter/SimpleFragmenter.h" -//#include "CLucene/highlighter/SimpleHTMLFormatter.h" -//#include "CLucene/analysis/standard/StandardAnalyzer.h" -// -//#define LCPIX_EXCERPT_FIELD L"_excerpt" +#include "CLucene/highlighter/SimpleFragmenter.h" +#include "CLucene/highlighter/SimpleHTMLFormatter.h" +#include "CLucene/analysis/standard/StandardAnalyzer.h" +#define LCPIX_DEFAULT_FIELD L"_aggregate" +#define LCPIX_HL_EXCERPT_FIELD L"_hlexcerpt" +#define LCPIX_EXCERPT_FIELD L"_excerpt" //#endif CL_NS_DEF(search) @@ -168,11 +169,11 @@ int32_t numDocs; // number cached int32_t maxDocs; // max to cache //#ifdef USE_HIGHLIGHTER -// CL_NS2(search,highlight)::SimpleHTMLFormatter hl_formatter; -// -// CL_NS2(search,highlight)::SimpleFragmenter hl_frag; -// -// CL_NS2(analysis,standard)::StandardAnalyzer hl_analyzer; + CL_NS2(search,highlight)::SimpleHTMLFormatter hl_formatter; + + CL_NS2(search,highlight)::SimpleFragmenter hl_frag; + + CL_NS2(analysis,standard)::StandardAnalyzer hl_analyzer; //#endif public: Hits(Searcher* s, Query* q, Filter* f, const Sort* sort=NULL); @@ -292,7 +293,7 @@ */ virtual TopFieldDocs* _search(Query* query, Filter* filter, const int32_t n, const Sort* sort) = 0; //#ifdef USE_HIGHLIGHTER -// virtual Query* getrewritten(int32_t n, Query* original)= 0; + virtual void getrewritten(int32_t n, Query* original, Query* rwQuery[])= 0; //#endif }; diff -r cf5c74390b98 -r 3e1f76dd2722 searcher/searchclient/bwins/cpixsearchclientu.def --- a/searcher/searchclient/bwins/cpixsearchclientu.def Wed Aug 18 10:53:26 2010 +0300 +++ b/searcher/searchclient/bwins/cpixsearchclientu.def Thu Sep 02 21:37:32 2010 +0300 @@ -99,4 +99,5 @@ ?UnDefineVolume@RSearchServerSession@@QAEHABVTDesC16@@@Z @ 98 NONAME ; int RSearchServerSession::UnDefineVolume(class TDesC16 const &) ?ExternalizeL@CDocumentField@@QBEXAAVRWriteStream@@@Z @ 99 NONAME ; void CDocumentField::ExternalizeL(class RWriteStream &) const ?AddL@RSearchServerSubSession@@QAEXABVTDesC8@@@Z @ 100 NONAME ; void RSearchServerSubSession::AddL(class TDesC8 const &) + ?AddHLDisplayFieldL@CSearchDocument@@QAEXABVTDesC16@@@Z @ 101 NONAME ; void CSearchDocument::AddHLDisplayFieldL(class TDesC16 const &) diff -r cf5c74390b98 -r 3e1f76dd2722 searcher/searchclient/eabi/cpixsearchclientu.def --- a/searcher/searchclient/eabi/cpixsearchclientu.def Wed Aug 18 10:53:26 2010 +0300 +++ b/searcher/searchclient/eabi/cpixsearchclientu.def Thu Sep 02 21:37:32 2010 +0300 @@ -116,4 +116,5 @@ _ZTV13CCPixSearcher @ 115 NONAME _ZTV14CDocumentField @ 116 NONAME _ZTV15CSearchDocument @ 117 NONAME + _ZN15CSearchDocument18AddHLDisplayFieldLERK7TDesC16 @ 118 NONAME diff -r cf5c74390b98 -r 3e1f76dd2722 searcher/searchclient/group/searchclient.mmp --- a/searcher/searchclient/group/searchclient.mmp Wed Aug 18 10:53:26 2010 +0300 +++ b/searcher/searchclient/group/searchclient.mmp Thu Sep 02 21:37:32 2010 +0300 @@ -40,7 +40,10 @@ LIBRARY estor.lib LIBRARY flogger.lib +LIBRARY centralrepository.lib CAPABILITY CAP_GENERAL_DLL +//Useto enable highlighter +MACRO USE_HIGHLIGHTER // End of File diff -r cf5c74390b98 -r 3e1f76dd2722 searcher/searchclient/src/ccpixsearcher.cpp --- a/searcher/searchclient/src/ccpixsearcher.cpp Wed Aug 18 10:53:26 2010 +0300 +++ b/searcher/searchclient/src/ccpixsearcher.cpp Thu Sep 02 21:37:32 2010 +0300 @@ -98,6 +98,7 @@ // EXPORT_C void CCPixSearcher::OpenDatabaseL(const TDesC& aBaseAppClass) { + OstTraceFunctionEntry0( CCPIXSEARCHER_OPENDATABASEL_ENTRY ); if ( IsActive() ) { User::Leave(KErrInUse); @@ -112,12 +113,14 @@ iBaseAppClass = aBaseAppClass.AllocL(); iSubSession.OpenDatabaseL(ETrue, *iBaseAppClass, *iDefaultSearchField); iIsDatabaseOpen = ETrue; + OstTraceFunctionExit0( CCPIXSEARCHER_OPENDATABASEL_EXIT ); } // // EXPORT_C void CCPixSearcher::OpenDatabaseL(MCPixOpenDatabaseRequestObserver& aObserver, const TDesC& aBaseAppClass) { + OstTraceFunctionEntry0( DUP1_CCPIXSEARCHER_OPENDATABASEL_ENTRY ); if ( IsActive() ) { User::Leave( KErrInUse); @@ -135,18 +138,22 @@ iBaseAppClass = aBaseAppClass.AllocL(); iSubSession.OpenDatabase(ETrue, *iBaseAppClass, *iDefaultSearchField, iStatus); // Create if not found SetActive(); + OstTraceFunctionExit0( DUP1_CCPIXSEARCHER_OPENDATABASEL_EXIT ); } EXPORT_C void CCPixSearcher::SetAnalyzerL( const TDesC& aAnalyzer ) { + OstTraceFunctionEntry0( CCPIXSEARCHER_SETANALYZERL_ENTRY ); if ( !iIsDatabaseOpen ) User::Leave(KErrNotReady); if ( IsActive() ) User::Leave(KErrInUse); iSubSession.SetAnalyzerL( aAnalyzer ); + OstTraceFunctionExit0( CCPIXSEARCHER_SETANALYZERL_EXIT ); } EXPORT_C void CCPixSearcher::SetAnalyzerL( MCPixSetAnalyzerRequestObserver& aObserver, const TDesC& aAnalyzer ) { + OstTraceFunctionEntry0( DUP1_CCPIXSEARCHER_SETANALYZERL_ENTRY ); if ( !iIsDatabaseOpen ) User::Leave(KErrNotReady); if ( IsActive() ) User::Leave(KErrInUse); @@ -156,6 +163,7 @@ iState = EStateSetAnalyzer; iSubSession.SetAnalyzer( aAnalyzer, iStatus ); SetActive(); + OstTraceFunctionExit0( DUP1_CCPIXSEARCHER_SETANALYZERL_EXIT ); } EXPORT_C void CCPixSearcher::SetQueryParserL( TQueryParser aQueryParser ) @@ -206,7 +214,7 @@ { OstTraceFunctionEntry0( CCPIXSEARCHER_SEARCHL_ENTRY ); PERFORMANCE_LOG_START("CCPixSearcher::SearchL"); - + OstTraceExt2( TRACE_NORMAL, CCPIXSEARCHER_SEARCHL, "CCPixSearcher::SearchL::sync::;Search string =%S;field=%S", aQueryString, aDocumentField ); if ( !iIsDatabaseOpen ) User::Leave( KErrNotReady ); if ( IsActive() ) @@ -229,6 +237,7 @@ OstTraceFunctionEntry0( DUP1_CCPIXSEARCHER_SEARCHL_ENTRY ); PERFORMANCE_LOG_START("CCPixSearcher::SearchL"); + OstTraceExt2( TRACE_NORMAL, DUP1_CCPIXSEARCHER_SEARCHL, "CCPixSearcher::SearchL::Async::;Search string=%S;Field=%S", aQueryString, aDocumentField ); if ( !iIsDatabaseOpen ) User::Leave( KErrNotReady ); if ( IsActive() ) { @@ -251,6 +260,7 @@ OstTraceFunctionEntry0( CCPIXSEARCHER_GETDOCUMENTL_ENTRY ); PERFORMANCE_LOG_START("CCPixSearcher::GetDocumentL"); + OstTrace1( TRACE_NORMAL, CCPIXSEARCHER_GETDOCUMENTL, "CCPixSearcher::GetDocumentL;aIndex=%d", aIndex ); if ( !iIsDatabaseOpen ) User::Leave( KErrNotReady ); if ( IsActive() ) { @@ -265,6 +275,7 @@ OstTraceFunctionEntry0( DUP1_CCPIXSEARCHER_GETDOCUMENTL_ENTRY ); PERFORMANCE_LOG_START("CCPixSearcher::GetDocumentL"); + OstTrace1( TRACE_NORMAL, DUP1_CCPIXSEARCHER_GETDOCUMENTL, "CCPixSearcher::GetDocumentL::Async::;aIndex=%d", aIndex ); if ( !iIsDatabaseOpen ) User::Leave( KErrNotReady ); if ( IsActive() ) { @@ -283,6 +294,7 @@ { PERFORMANCE_LOG_START("CCPixSearcher::GetBatchDocumentL"); + OstTraceExt2( TRACE_NORMAL, CCPIXSEARCHER_GETBATCHDOCUMENTL, "CCPixSearcher::GetBatchDocumentL;aIndex=%d;aCount=%d", aIndex, aCount ); if ( !iIsDatabaseOpen ) User::Leave( KErrNotReady ); if ( IsActive() ) { @@ -296,6 +308,7 @@ { PERFORMANCE_LOG_START("CCPixSearcher::GetBatchDocumentL"); + OstTraceExt2( TRACE_NORMAL, DUP1_CCPIXSEARCHER_GETBATCHDOCUMENTL, "CCPixSearcher::GetBatchDocumentL::Async::;aIndex=%d;aCount=%d", aIndex, aCount ); if ( !iIsDatabaseOpen ) User::Leave( KErrNotReady ); if ( IsActive() ) { @@ -381,6 +394,7 @@ TRAPD( err, document = iSubSession.GetBatchDocumentObjectL( retCount ) ); if ( observer.iNextDocument ) { + OstTraceExt2( TRACE_NORMAL, CCPIXSEARCHER_RUNL, "CCPixSearcher::RunL::BatchgetDoc::;err=%d;retcount=%d", err, retCount ); if ( err == KErrNone ) { observer.iNextDocument->HandleBatchDocumentL(iStatus.Int(),retCount, document); diff -r cf5c74390b98 -r 3e1f76dd2722 searcher/searchclient/src/csearchdocument.cpp --- a/searcher/searchclient/src/csearchdocument.cpp Wed Aug 18 10:53:26 2010 +0300 +++ b/searcher/searchclient/src/csearchdocument.cpp Thu Sep 02 21:37:32 2010 +0300 @@ -246,3 +246,10 @@ return iBoost; } +#ifdef USE_HIGHLIGHTER +EXPORT_C void CSearchDocument::AddHLDisplayFieldL(const TDesC& aField) + { + // Needs to be tokenised to rewrite the query, but should not be searchable so EAggregateNo. + AddFieldL( _L( CPIX_HL_EXCERPT_FIELD ), aField, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EAggregateNo ); + } +#endif diff -r cf5c74390b98 -r 3e1f76dd2722 searcher/searchclient/src/rsearchserversession.cpp --- a/searcher/searchclient/src/rsearchserversession.cpp Wed Aug 18 10:53:26 2010 +0300 +++ b/searcher/searchclient/src/rsearchserversession.cpp Thu Sep 02 21:37:32 2010 +0300 @@ -28,12 +28,13 @@ #ifdef OST_TRACE_COMPILER_IN_USE #include "rsearchserversessionTraces.h" #endif - +#include "cpixwatchdogcommon.h" +#include // FUNCTION PROTOTYPES -static TInt StartServer(); -static TInt CreateServerProcess(); +static TInt StartServer( const TDesC& aServerName , TUid aServerUid ); +static TInt CreateServerProcess( const TDesC& aServerName , TUid aServerUid ); // RsearchServerSession::RsearchServerSession() // C++ default constructor can NOT contain any code, that might leave. @@ -48,12 +49,45 @@ // ----------------------------------------------------------------------------- EXPORT_C TInt RSearchServerSession::Connect() { - TInt err = StartServer(); - - if ( KErrNone == err ) - { - err = CreateSession(KSearchServerName, Version(), KDefaultMessageSlots); - } + //read the name and Uid of the search server + TInt err = KErrNotReady; + // get the watchdog repro + //TRAP_IGNORE is used to avoid the code scanner error + CRepository* wdrepo = NULL; + TRAP_IGNORE(wdrepo = CRepository::NewL( KWDrepoUidMenu )); + if ( wdrepo ) + { + HBufC* servername = NULL; + TUid serveruid = {0}; + TBuf temp; + TInt64 value; + TLex uidvalue; + //read the searchserver UId + if ( KErrNone == wdrepo->Get( KSearchServerUIDKey, temp )) + { + uidvalue.Assign(temp); + if (KErrNone == uidvalue.Val( value,EHex )) + serveruid.iUid = value; + } + //read the search server name + if ( KErrNone == wdrepo->Get( KSearchServerNAMEKey, temp )) + { + //TRAP_IGNORE is used to avoid the code scanner error + TRAP_IGNORE(servername = HBufC::NewL( temp.Length() )); + TPtr ssname = servername->Des(); + ssname.Copy( temp ); + } + // make sure the server is started before creating connection + if ( servername ) + err = StartServer( *servername , serveruid ); + + if ( KErrNone == err ) + { + err = CreateSession(*servername, Version(), KDefaultMessageSlots); + } + delete servername; + } + delete wdrepo; return err; } @@ -232,6 +266,7 @@ // descriptors as they will be out of scope by the time the server // attempts to read or write User::LeaveIfError( SendReceive(ESearchServerSearch, args) ); + OstTrace1( TRACE_NORMAL, RSEARCHSERVERSUBSESSION_SEARCHL, "RSearchServerSubSession::SearchL::sync;iEstimatedResultsCount=%d", iEstimatedResultsCount ); OstTraceFunctionExit0( RSEARCHSERVERSUBSESSION_SEARCHL_EXIT ); } @@ -352,7 +387,7 @@ delete iSizeList; iSizeList = NULL; } - iSizeList = STATIC_CAST(TInt *, User::AllocZL(iReqCount * sizeof(TInt))); + TRAP_IGNORE(iSizeList = STATIC_CAST(TInt *, User::AllocZL(iReqCount * sizeof(TInt)))); //iDocSizeArray TPtr8 blob((TUint8*)iSizeList, iReqCount * sizeof(TInt)); @@ -483,11 +518,11 @@ // StartServer() // Starts the server if it is not already running -static TInt StartServer() +static TInt StartServer( const TDesC& aServerName , TUid aServerUid ) { TInt result; - TFindServer findsearchServer(KSearchServerName); + TFindServer findsearchServer(aServerName); TFullName name; result = findsearchServer.Next(name); @@ -504,7 +539,7 @@ return result; } - result = CreateServerProcess(); + result = CreateServerProcess( aServerName,aServerUid ); if (result != KErrNone) { return result; @@ -518,15 +553,15 @@ // CreateServerProcess() // Creates a server process -static TInt CreateServerProcess() +static TInt CreateServerProcess( const TDesC& aServerName , TUid aServerUid ) { TInt result; - const TUidType serverUid( KNullUid, KNullUid, KServerUid3); + const TUidType serverUid( KNullUid, KNullUid, aServerUid); RProcess server; - result = server.Create(KSearchServerFilename, KNullDesC, serverUid); + result = server.Create(aServerName, KNullDesC, serverUid); if (result != KErrNone) { return result; diff -r cf5c74390b98 -r 3e1f76dd2722 searcher/searchclient/traces/CCPixSearcherTraces.h --- a/searcher/searchclient/traces/CCPixSearcherTraces.h Wed Aug 18 10:53:26 2010 +0300 +++ b/searcher/searchclient/traces/CCPixSearcherTraces.h Thu Sep 02 21:37:32 2010 +0300 @@ -12,6 +12,158 @@ #define CCPIXSEARCHER_GETDOCUMENTL_ENTRY 0x8a0004 #define DUP1_CCPIXSEARCHER_GETDOCUMENTL_ENTRY 0x8a0005 #define CCPIXSEARCHER_GETDOCUMENTL_EXIT 0x8a0006 +#define CCPIXSEARCHER_OPENDATABASEL_ENTRY 0x8a0010 +#define CCPIXSEARCHER_OPENDATABASEL_EXIT 0x8a0011 +#define DUP1_CCPIXSEARCHER_OPENDATABASEL_ENTRY 0x8a0012 +#define DUP1_CCPIXSEARCHER_OPENDATABASEL_EXIT 0x8a0013 +#define CCPIXSEARCHER_SETANALYZERL_ENTRY 0x8a0014 +#define CCPIXSEARCHER_SETANALYZERL_EXIT 0x8a0015 +#define DUP1_CCPIXSEARCHER_SETANALYZERL_ENTRY 0x8a0016 +#define DUP1_CCPIXSEARCHER_SETANALYZERL_EXIT 0x8a0017 +#define CCPIXSEARCHER_SEARCHL 0x860003 +#define DUP1_CCPIXSEARCHER_SEARCHL 0x860004 +#define CCPIXSEARCHER_GETDOCUMENTL 0x860005 +#define DUP1_CCPIXSEARCHER_GETDOCUMENTL 0x860006 +#define CCPIXSEARCHER_GETBATCHDOCUMENTL 0x860007 +#define DUP1_CCPIXSEARCHER_GETBATCHDOCUMENTL 0x860008 +#define CCPIXSEARCHER_RUNL 0x860009 + + +#ifndef __KERNEL_MODE__ +#ifndef __OSTTRACEGEN2_TUINT32_CONST_TDESC16REF_CONST_TDESC16REF__ +#define __OSTTRACEGEN2_TUINT32_CONST_TDESC16REF_CONST_TDESC16REF__ + +inline TBool OstTraceGen2( TUint32 aTraceID, const TDesC16& aParam1, const TDesC16& aParam2 ) + { + TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID ); + if ( retval ) + { + TInt length = 0; + // Check that parameter lenght is not too long + TInt length1 = aParam1.Size(); + if ((length + length1 + sizeof ( TUint32 )) > KOstMaxDataLength) + { + length1 = KOstMaxDataLength - (length + sizeof ( TUint32 )); + } + TInt lengthAligned1 = ( length1 + 3 ) & ~3; + if (lengthAligned1 > 0) + { + length = length + sizeof ( TUint32 ) + lengthAligned1; + } + // Check that parameter lenght is not too long + TInt length2 = aParam2.Size(); + if ((length + length2 + sizeof ( TUint32 )) > KOstMaxDataLength) + { + length2 = KOstMaxDataLength - (length + sizeof ( TUint32 )); + } + TInt lengthAligned2 = ( length2 + 3 ) & ~3; + if (lengthAligned2 > 0) + { + length = length + sizeof ( TUint32 ) + lengthAligned2; + } + TUint8 data[ KOstMaxDataLength ]; + TUint8* ptr = data; + // Set length to zero and calculate it againg + // when adding parameters + length = 0; + if (length1 > 0) + { + // Number of elements is written before data + // In case of Unicode string, number of elements is half of length + *( ( TUint32* )ptr ) = length1 / (aParam1.Size() / aParam1.Length()); + ptr += sizeof ( TUint32 ); + memcpy( ptr, aParam1.Ptr(), length1 ); + ptr += length1; + // Fillers are written to get 32-bit alignment + while ( length1++ < lengthAligned1 ) + { + *ptr++ = 0; + } + length += sizeof ( TUint32 ) + lengthAligned1; + } + else if (length + sizeof ( TUint32 ) <= KOstMaxDataLength) + { + *( ( TUint32* )ptr ) = 0; + ptr += sizeof ( TUint32 ); + length += sizeof ( TUint32 ); + } + if (length2 > 0) + { + // Number of elements is written before data + // In case of Unicode string, number of elements is half of length + *( ( TUint32* )ptr ) = length2 / (aParam2.Size() / aParam2.Length()); + ptr += sizeof ( TUint32 ); + memcpy( ptr, aParam2.Ptr(), length2 ); + ptr += length2; + // Fillers are written to get 32-bit alignment + while ( length2++ < lengthAligned2 ) + { + *ptr++ = 0; + } + length += sizeof ( TUint32 ) + lengthAligned2; + } + else if (length + sizeof ( TUint32 ) <= KOstMaxDataLength) + { + *( ( TUint32* )ptr ) = 0; + ptr += sizeof ( TUint32 ); + length += sizeof ( TUint32 ); + } + ptr -= length; + retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, length ); + } + return retval; + } + +#endif // __OSTTRACEGEN2_TUINT32_CONST_TDESC16REF_CONST_TDESC16REF__ + +#endif + + +#ifndef __OSTTRACEGEN2_TUINT32_TINT_TINT__ +#define __OSTTRACEGEN2_TUINT32_TINT_TINT__ + +inline TBool OstTraceGen2( TUint32 aTraceID, TInt aParam1, TInt aParam2 ) + { + TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID ); + if ( retval ) + { + TUint8 data[ 8 ]; + TUint8* ptr = data; + *( ( TInt* )ptr ) = aParam1; + ptr += sizeof ( TInt ); + *( ( TInt* )ptr ) = aParam2; + ptr += sizeof ( TInt ); + ptr -= 8; + retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 8 ); + } + return retval; + } + +#endif // __OSTTRACEGEN2_TUINT32_TINT_TINT__ + + +#ifndef __OSTTRACEGEN2_TUINT32_TINT32_TINT32__ +#define __OSTTRACEGEN2_TUINT32_TINT32_TINT32__ + +inline TBool OstTraceGen2( TUint32 aTraceID, TInt32 aParam1, TInt32 aParam2 ) + { + TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID ); + if ( retval ) + { + TUint8 data[ 8 ]; + TUint8* ptr = data; + *( ( TInt* )ptr ) = aParam1; + ptr += sizeof ( TInt ); + *( ( TInt* )ptr ) = aParam2; + ptr += sizeof ( TInt ); + ptr -= 8; + retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 8 ); + } + return retval; + } + +#endif // __OSTTRACEGEN2_TUINT32_TINT32_TINT32__ + #endif diff -r cf5c74390b98 -r 3e1f76dd2722 searcher/searchclient/traces/RSearchServerSessionTraces.h --- a/searcher/searchclient/traces/RSearchServerSessionTraces.h Wed Aug 18 10:53:26 2010 +0300 +++ b/searcher/searchclient/traces/RSearchServerSessionTraces.h Thu Sep 02 21:37:32 2010 +0300 @@ -17,6 +17,7 @@ #define RSEARCHSERVERSUBSESSION_GETDOCUMENTOBJECTL_EXIT 0x8a000f #define RSEARCHSERVERSUBSESSION_UPDATEL 0x860001 #define DUP1_RSEARCHSERVERSUBSESSION_UPDATEL 0x860002 +#define RSEARCHSERVERSUBSESSION_SEARCHL 0x86000a #endif diff -r cf5c74390b98 -r 3e1f76dd2722 searcher/searchclient/traces/fixed_id.definitions --- a/searcher/searchclient/traces/fixed_id.definitions Wed Aug 18 10:53:26 2010 +0300 +++ b/searcher/searchclient/traces/fixed_id.definitions Thu Sep 02 21:37:32 2010 +0300 @@ -3,10 +3,18 @@ [GROUP]TRACE_NORMAL=0x86 [TRACE]TRACE_FLOW[0x8A]_CCPIXSEARCHER_GETDOCUMENTL_ENTRY=0x4 [TRACE]TRACE_FLOW[0x8A]_CCPIXSEARCHER_GETDOCUMENTL_EXIT=0x6 +[TRACE]TRACE_FLOW[0x8A]_CCPIXSEARCHER_OPENDATABASEL_ENTRY=0x10 +[TRACE]TRACE_FLOW[0x8A]_CCPIXSEARCHER_OPENDATABASEL_EXIT=0x11 [TRACE]TRACE_FLOW[0x8A]_CCPIXSEARCHER_SEARCHL_ENTRY=0x1 [TRACE]TRACE_FLOW[0x8A]_CCPIXSEARCHER_SEARCHL_EXIT=0x3 +[TRACE]TRACE_FLOW[0x8A]_CCPIXSEARCHER_SETANALYZERL_ENTRY=0x14 +[TRACE]TRACE_FLOW[0x8A]_CCPIXSEARCHER_SETANALYZERL_EXIT=0x15 [TRACE]TRACE_FLOW[0x8A]_DUP1_CCPIXSEARCHER_GETDOCUMENTL_ENTRY=0x5 +[TRACE]TRACE_FLOW[0x8A]_DUP1_CCPIXSEARCHER_OPENDATABASEL_ENTRY=0x12 +[TRACE]TRACE_FLOW[0x8A]_DUP1_CCPIXSEARCHER_OPENDATABASEL_EXIT=0x13 [TRACE]TRACE_FLOW[0x8A]_DUP1_CCPIXSEARCHER_SEARCHL_ENTRY=0x2 +[TRACE]TRACE_FLOW[0x8A]_DUP1_CCPIXSEARCHER_SETANALYZERL_ENTRY=0x16 +[TRACE]TRACE_FLOW[0x8A]_DUP1_CCPIXSEARCHER_SETANALYZERL_EXIT=0x17 [TRACE]TRACE_FLOW[0x8A]_RSEARCHSERVERSUBSESSION_GETDOCUMENTL_ENTRY=0xb [TRACE]TRACE_FLOW[0x8A]_RSEARCHSERVERSUBSESSION_GETDOCUMENTOBJECTL_ENTRY=0xe [TRACE]TRACE_FLOW[0x8A]_RSEARCHSERVERSUBSESSION_GETDOCUMENTOBJECTL_EXIT=0xf @@ -16,5 +24,13 @@ [TRACE]TRACE_FLOW[0x8A]_RSEARCHSERVERSUBSESSION_SEARCHL_EXIT=0x8 [TRACE]TRACE_FLOW[0x8A]_RSEARCHSERVERSUBSESSION_SEARCH_ENTRY=0x9 [TRACE]TRACE_FLOW[0x8A]_RSEARCHSERVERSUBSESSION_SEARCH_EXIT=0xa +[TRACE]TRACE_NORMAL[0x86]_CCPIXSEARCHER_GETBATCHDOCUMENTL=0x7 +[TRACE]TRACE_NORMAL[0x86]_CCPIXSEARCHER_GETDOCUMENTL=0x5 +[TRACE]TRACE_NORMAL[0x86]_CCPIXSEARCHER_RUNL=0x9 +[TRACE]TRACE_NORMAL[0x86]_CCPIXSEARCHER_SEARCHL=0x3 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CCPIXSEARCHER_GETBATCHDOCUMENTL=0x8 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CCPIXSEARCHER_GETDOCUMENTL=0x6 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CCPIXSEARCHER_SEARCHL=0x4 [TRACE]TRACE_NORMAL[0x86]_DUP1_RSEARCHSERVERSUBSESSION_UPDATEL=0x2 +[TRACE]TRACE_NORMAL[0x86]_RSEARCHSERVERSUBSESSION_SEARCHL=0xa [TRACE]TRACE_NORMAL[0x86]_RSEARCHSERVERSUBSESSION_UPDATEL=0x1 diff -r cf5c74390b98 -r 3e1f76dd2722 searcher/searchserver/group/searchserver.mmp --- a/searcher/searchserver/group/searchserver.mmp Wed Aug 18 10:53:26 2010 +0300 +++ b/searcher/searchserver/group/searchserver.mmp Thu Sep 02 21:37:32 2010 +0300 @@ -94,4 +94,8 @@ CAPABILITY CAP_SERVER AllFiles +//Used to enable highlighter +//MACRO USE_HIGHLIGHTER + + // End of File diff -r cf5c74390b98 -r 3e1f76dd2722 searcher/searchserver/inc/CCPixAbstractSearcher.h --- a/searcher/searchserver/inc/CCPixAbstractSearcher.h Wed Aug 18 10:53:26 2010 +0300 +++ b/searcher/searchserver/inc/CCPixAbstractSearcher.h Thu Sep 02 21:37:32 2010 +0300 @@ -25,8 +25,8 @@ public: enum TQueryParser { - EDatabaseQueryParser = 0, - EIncrementalQueryParser = 1 + ECluceneQueryParser = 0, + EPrefixQueryParser = 1 }; @@ -111,7 +111,7 @@ static CSearchDocument* ConvertDocumentL( cpix_Document* aDocument ); - static RPointerArray ConvertBatchDocumentL( cpix_Document** aDocument, TInt count ); + static RPointerArray ConvertBatchDocumentL( cpix_Document**& aDocument, TInt count ); static RArray docSizeArray; diff -r cf5c74390b98 -r 3e1f76dd2722 searcher/searchserver/src/CCPixAbstractSearcher.cpp --- a/searcher/searchserver/src/CCPixAbstractSearcher.cpp Wed Aug 18 10:53:26 2010 +0300 +++ b/searcher/searchserver/src/CCPixAbstractSearcher.cpp Thu Sep 02 21:37:32 2010 +0300 @@ -103,7 +103,7 @@ return document; } -RPointerArray CCPixAbstractSearcher::ConvertBatchDocumentL( cpix_Document** aDocument, TInt aCount ) +RPointerArray CCPixAbstractSearcher::ConvertBatchDocumentL( cpix_Document**& aDocument, TInt aCount ) { // Read first the system fields that are passed as constructor parameters // @@ -182,11 +182,10 @@ CleanupStack::PopAndDestroy(docFieldEnum); CleanupStack::Pop(document); docSizeArray.AppendL( document->Size()); - docArray.AppendL( document ); - delete nextDocument; - nextDocument = NULL; + docArray.AppendL( document ); } - else break; + delete nextDocument; + nextDocument = NULL; } delete aDocument; aDocument = NULL; diff -r cf5c74390b98 -r 3e1f76dd2722 searcher/searchserver/src/ccpixsearch.cpp --- a/searcher/searchserver/src/ccpixsearch.cpp Wed Aug 18 10:53:26 2010 +0300 +++ b/searcher/searchserver/src/ccpixsearch.cpp Thu Sep 02 21:37:32 2010 +0300 @@ -45,7 +45,7 @@ } CCPixSearch::CCPixSearch() - : iQueryParserType(EIncrementalQueryParser), + : iQueryParserType(EPrefixQueryParser), iPendingTask(EPendingTaskNone) { @@ -134,6 +134,8 @@ TBool CCPixSearch::SearchL(const TDesC& aSearchTerms, MCPixAsyncronizerObserver* aObserver, const RMessage2& aMessage) { + _LIT16(KPlain,"$plain"); + _LIT16(KPrefix,"$prefix"); OstTraceFunctionEntry0( CCPIXSEARCH_SEARCHL_ENTRY ); PERFORMANCE_LOG_START("CCPixSearch::SearchL"); @@ -149,6 +151,15 @@ TPtr searchTermsPtr = searchTerms->Des(); searchTermsPtr.Copy(aSearchTerms); + if(aSearchTerms.Find(KPlain) == 0 && iQueryParserType == EPrefixQueryParser ) + { + SetQueryParserL(ECluceneQueryParser); + } + else if (aSearchTerms.Find(KPrefix) == 0 && iQueryParserType == ECluceneQueryParser ) + { + SetQueryParserL(EPrefixQueryParser); + } + // Destroy previous query cpix_Query_destroy( iQuery ); iQuery = NULL; @@ -379,7 +390,7 @@ iQueryParser = NULL; cpix_Result result; - if ( iQueryParserType == EDatabaseQueryParser ) + if ( iQueryParserType == ECluceneQueryParser ) { iQueryParser = cpix_QueryParser_create( &result, @@ -387,7 +398,7 @@ iDefaultSearchFieldZ->Des().PtrZ()), iAnalyzer ); } - else if ( iQueryParserType == EIncrementalQueryParser ) + else if ( iQueryParserType == EPrefixQueryParser ) { iQueryParser = cpix_CreatePrefixQueryParser( &result, diff -r cf5c74390b98 -r 3e1f76dd2722 searcher/searchserver/src/csearchserversubsession.cpp --- a/searcher/searchserver/src/csearchserversubsession.cpp Wed Aug 18 10:53:26 2010 +0300 +++ b/searcher/searchserver/src/csearchserversubsession.cpp Thu Sep 02 21:37:32 2010 +0300 @@ -269,6 +269,7 @@ // Sanity check if (!iSearchDb->IsOpen()) { + OstTrace0( TRACE_NORMAL, CSEARCHSERVERSUBSESSION_GETBATCHDOCUMENTL, "CSearchServerSubSession::GetBatchDocumentL: Panic as DB is not open" ); iSession->PanicClient(aMessage, EDatabaseNotOpen); return; } diff -r cf5c74390b98 -r 3e1f76dd2722 searcher/searchserver/traces/CSearchServerSubSessionTraces.h --- a/searcher/searchserver/traces/CSearchServerSubSessionTraces.h Wed Aug 18 10:53:26 2010 +0300 +++ b/searcher/searchserver/traces/CSearchServerSubSessionTraces.h Thu Sep 02 21:37:32 2010 +0300 @@ -10,6 +10,7 @@ #define DUP1_CSEARCHSERVERSUBSESSION_CSEARCHSERVERSUBSESSION 0x86000c #define CSEARCHSERVERSUBSESSION_LIMITEXCERPTTOMAXLENGTHL 0x86000d #define DUP1_CSEARCHSERVERSUBSESSION_LIMITEXCERPTTOMAXLENGTHL 0x86000e +#define CSEARCHSERVERSUBSESSION_GETBATCHDOCUMENTL 0x86000f #define CSEARCHSERVERSUBSESSION_SEARCHL_ENTRY 0x8a000c #define CSEARCHSERVERSUBSESSION_SEARCHL_EXIT 0x8a000d #define DUP1_CSEARCHSERVERSUBSESSION_SEARCHL_EXIT 0x8a000e diff -r cf5c74390b98 -r 3e1f76dd2722 searcher/searchserver/traces/fixed_id.definitions --- a/searcher/searchserver/traces/fixed_id.definitions Wed Aug 18 10:53:26 2010 +0300 +++ b/searcher/searchserver/traces/fixed_id.definitions Thu Sep 02 21:37:32 2010 +0300 @@ -32,6 +32,7 @@ [TRACE]TRACE_NORMAL[0x86]_CPIXIDXDB_DUMPDOCUMENT=0x1 [TRACE]TRACE_NORMAL[0x86]_CSEARCHSERVERSESSION_CSEARCHSERVERSESSION=0x9 [TRACE]TRACE_NORMAL[0x86]_CSEARCHSERVERSUBSESSION_CSEARCHSERVERSUBSESSION=0xb +[TRACE]TRACE_NORMAL[0x86]_CSEARCHSERVERSUBSESSION_GETBATCHDOCUMENTL=0xf [TRACE]TRACE_NORMAL[0x86]_CSEARCHSERVERSUBSESSION_LIMITEXCERPTTOMAXLENGTHL=0xd [TRACE]TRACE_NORMAL[0x86]_CSEARCHSERVER_CSEARCHSERVER=0x8 [TRACE]TRACE_NORMAL[0x86]_DUP1_CPIXIDXDB_DUMPDOCUMENT=0x2 diff -r cf5c74390b98 -r 3e1f76dd2722 searcher/tsrc/cpixsearchertest/group/cpixsearchertest.mmp --- a/searcher/tsrc/cpixsearchertest/group/cpixsearchertest.mmp Wed Aug 18 10:53:26 2010 +0300 +++ b/searcher/tsrc/cpixsearchertest/group/cpixsearchertest.mmp Thu Sep 02 21:37:32 2010 +0300 @@ -95,6 +95,7 @@ LIBRARY FLOGGER.lib LIBRARY estor.lib LIBRARY efsrv.lib +LIBRARY centralrepository.lib EPOCALLOWDLLDATA // End of File diff -r cf5c74390b98 -r 3e1f76dd2722 searchsrv_plat/cpix_framework_api/inc/csearchdocument.h --- a/searchsrv_plat/cpix_framework_api/inc/csearchdocument.h Wed Aug 18 10:53:26 2010 +0300 +++ b/searchsrv_plat/cpix_framework_api/inc/csearchdocument.h Thu Sep 02 21:37:32 2010 +0300 @@ -181,6 +181,17 @@ * ranked higher in the search results. */ IMPORT_C TReal32 Boost() const; + +#ifdef USE_HIGHLIGHTER + /** + * Adds the contents to field which will be + * shown in the first line of searchUI. + * The fields included here in this field should + * not be included in excerpt field(second line in seachUI) + * @param aExcerpt Excerpt text to add to the document. + */ + IMPORT_C void AddHLDisplayFieldL(const TDesC& aField); +#endif private: // Constructors diff -r cf5c74390b98 -r 3e1f76dd2722 searchsrv_plat/cpix_utility_api/group/bld.inf --- a/searchsrv_plat/cpix_utility_api/group/bld.inf Wed Aug 18 10:53:26 2010 +0300 +++ b/searchsrv_plat/cpix_utility_api/group/bld.inf Thu Sep 02 21:37:32 2010 +0300 @@ -28,4 +28,5 @@ ../inc/indevicecfg.h MW_LAYER_PLATFORM_EXPORT_PATH(indevicecfg.h) ../inc/messageharvesterdefs.h MW_LAYER_PLATFORM_EXPORT_PATH(messageharvesterdefs.h) ../inc/searchserverdefs.h MW_LAYER_PLATFORM_EXPORT_PATH(searchserverdefs.h) -../inc/cpixcontentinfocommon.h MW_LAYER_PLATFORM_EXPORT_PATH(cpixcontentinfocommon.h) \ No newline at end of file +../inc/cpixcontentinfocommon.h MW_LAYER_PLATFORM_EXPORT_PATH(cpixcontentinfocommon.h) +../inc/cpixwatchdogcommon.h MW_LAYER_PLATFORM_EXPORT_PATH(cpixwatchdogcommon.h) \ No newline at end of file diff -r cf5c74390b98 -r 3e1f76dd2722 searchsrv_plat/cpix_utility_api/inc/cpixmaindefs.h --- a/searchsrv_plat/cpix_utility_api/inc/cpixmaindefs.h Wed Aug 18 10:53:26 2010 +0300 +++ b/searchsrv_plat/cpix_utility_api/inc/cpixmaindefs.h Thu Sep 02 21:37:32 2010 +0300 @@ -100,6 +100,13 @@ */ #define LCPIX_EXCERPT_FIELD L"_excerpt" +/* + * The name of the optional field that will store the first line + * text shown in result of searchUI, used for highlighting + */ + +#define LCPIX_HL_EXCERPT_FIELD L"_hlexcerpt" + /** * The name of the optional field that will store the application * ID of the document. diff -r cf5c74390b98 -r 3e1f76dd2722 searchsrv_plat/cpix_utility_api/inc/cpixwatchdogcommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/searchsrv_plat/cpix_utility_api/inc/cpixwatchdogcommon.h Thu Sep 02 21:37:32 2010 +0300 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef CPIXWATCHDOGCOMMON_H_ +#define CPIXWATCHDOGCOMMON_H_ + +//Length of uid string in cenrep +const TInt KCenrepUidLength = 20; +//Uid of watchdog cetral repository database +const TUid KWDrepoUidMenu = {0x20029ab8}; +const TUint32 KHarvesterServerKey = 0x1; +const TUint32 KSearchServerKey = 0x2; +const TUint32 KHarvesterServerUIDKey = 0x3; +const TUint32 KHarvesterServerNAMEKey = 0x4; +const TUint32 KSearchServerUIDKey = 0x5; +const TUint32 KSearchServerNAMEKey = 0x6; +const TUint32 KSearchUiUIDKey = 0x7; + + +#endif /*CPIXWATCHDOGCOMMON_H_*/ diff -r cf5c74390b98 -r 3e1f76dd2722 sis/centrep.pkg --- a/sis/centrep.pkg Wed Aug 18 10:53:26 2010 +0300 +++ b/sis/centrep.pkg Thu Sep 02 21:37:32 2010 +0300 @@ -2,7 +2,7 @@ &EN ; Header -#{ "CenRep INI file"}, (0x10202BE9), 1, 2, 3, TYPE=SP +#{ "CenRep INI file"}, (0x10202BE9), 1, 2, 3, TYPE=SP, RU; ; Localised Vendor name %{"Nokia"} diff -r cf5c74390b98 -r 3e1f76dd2722 sis/cpixsearch.pkg.source --- a/sis/cpixsearch.pkg.source Wed Aug 18 10:53:26 2010 +0300 +++ b/sis/cpixsearch.pkg.source Thu Sep 02 21:37:32 2010 +0300 @@ -13,10 +13,14 @@ ; ; UID is the app's UID ; -#{"CPix Search"},(0x2001F6FB),1,0,0, TYPE=SA;$(SVN) +#{"CPix Search"},(0x2001F6FB),1,1,0, TYPE=SA, RU;$(SVN) ; Supports Series 60 v 3.0 -[0x101F7961], 0, 0, 0, {"S60ProductID"} +[0x101F7961],0,0,0,{"S60ProductID"} +[0x102032BE],0,0,0,{"S60ProductID"} +[0x102752AE],0,0,0,{"S60ProductID"} +[0x1028315F],0,0,0,{"S60ProductID"} +[0x20022e6d],0,0,0,{"S60ProductID"} ; Vendor names %{"Nokia-EN"} @@ -28,6 +32,11 @@ ;@"cpix_cert_installer.sis", (0x101FB665) ;@"..\WidgetInstaller\sis\WidgetInstaller.sisx", (0x2001F709) +; CPiX Harvester Server + +"$(EPOCROOT)epoc32\release\armv5\$(TARGET)\CPixHarvesterServer.exe" +-"c:\sys\bin\CPixHarvesterServer.exe" + ; CPiX Search Server "$(EPOCROOT)epoc32\release\armv5\$(TARGET)\CPixSearchServer.exe" @@ -48,11 +57,6 @@ ;"$(EPOCROOT)epoc32\release\armv5\$(TARGET)\qtcpixapplauncher.dll" ;-"c:\sys\bin\qtcpixapplauncher.dll" -; CPiX Harvester Server - -"$(EPOCROOT)epoc32\release\armv5\$(TARGET)\CPixHarvesterServer.exe" --"c:\sys\bin\CPixHarvesterServer.exe" - ; HarvesterServer is started at boot time - copy resource file ; must be hardcoded 'c' drive for this file "$(EPOCROOT)epoc32\data\z\private\101f875a\import\2001F6FB.rsc" @@ -130,4 +134,7 @@ ;Qt Email fetcher "\epoc32\release\armv5\$(TARGET)\qtemailfetcher.dll" --"c:\sys\bin\qtemailfetcher.dll" \ No newline at end of file +-"c:\sys\bin\qtemailfetcher.dll" + +@"..\watchdog\sis\WatchDog.sisx", (0x20029AB8) + diff -r cf5c74390b98 -r 3e1f76dd2722 watchdog/cenrep/20029AB8.cre Binary file watchdog/cenrep/20029AB8.cre has changed diff -r cf5c74390b98 -r 3e1f76dd2722 watchdog/cenrep/20029AB8.txt Binary file watchdog/cenrep/20029AB8.txt has changed diff -r cf5c74390b98 -r 3e1f76dd2722 watchdog/group/bld.inf --- a/watchdog/group/bld.inf Wed Aug 18 10:53:26 2010 +0300 +++ b/watchdog/group/bld.inf Thu Sep 02 21:37:32 2010 +0300 @@ -21,3 +21,7 @@ PRJ_MMPFILES WatchDog.mmp + +PRJ_EXPORTS +../cenrep/20029AB8.cre /epoc32/winscw/c/private/10202be9/20029AB8.cre +../cenrep/20029AB8.cre /epoc32/data/z/private/10202be9/20029AB8.cre diff -r cf5c74390b98 -r 3e1f76dd2722 watchdog/group/watchdog.mmp --- a/watchdog/group/watchdog.mmp Wed Aug 18 10:53:26 2010 +0300 +++ b/watchdog/group/watchdog.mmp Thu Sep 02 21:37:32 2010 +0300 @@ -30,9 +30,10 @@ MW_LAYER_SYSTEMINCLUDE SOURCEPATH ../src -SOURCE WatchDog.cpp CWDMonitor.cpp CWDTimer.cpp +SOURCE WatchDog.cpp CWDMonitor.cpp CWDTimer.cpp centrepmonitor.cpp LIBRARY euser.lib +LIBRARY centralrepository.lib // For logging LIBRARY flogger.lib diff -r cf5c74390b98 -r 3e1f76dd2722 watchdog/inc/centrepmonitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/watchdog/inc/centrepmonitor.h Thu Sep 02 21:37:32 2010 +0300 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef CENTREPMONITOR_H_ +#define CENTREPMONITOR_H_ + +#include +#include "mcentrephandler.h" + +class CRepository; + +class CentrepMonitor : public CActive + { +public: + /* + * Construction + * @return instance of CentrepMonitor + */ + static CentrepMonitor* NewL( MCentrepHandler* aCentrepHandler, TUint32 aKey ); //For callback + /* + * Construction + * @return instance of CentrepMonitor + */ + static CentrepMonitor* NewLC( MCentrepHandler* aCentrepHandler, TUint32 aKey ); + /* + * Destructor + */ + virtual ~CentrepMonitor(); +public: + /* + * Srats the notifier to monitor the changes done for HS and SS centrep key + */ + void StartNotifier(); + + //From CActive + void RunL(); + void DoCancel(); + TInt RunError( TInt aError ); +private: + /* + * Constructor + */ + CentrepMonitor(); + + /* + * Second phase constructor + */ + void ConstructL( MCentrepHandler* aCentrepHandler, TUint32 aKey ); + +private: + + TUint32 iKey; + //centrep handler.Not owned + MCentrepHandler* iCentrepHandler; + //repository db for watchdog.owned + CRepository* aWDrepo; + }; + + +#endif //CENTREPMONITOR_H_ diff -r cf5c74390b98 -r 3e1f76dd2722 watchdog/inc/cwdmonitor.h --- a/watchdog/inc/cwdmonitor.h Wed Aug 18 10:53:26 2010 +0300 +++ b/watchdog/inc/cwdmonitor.h Thu Sep 02 21:37:32 2010 +0300 @@ -21,11 +21,13 @@ #include #include "MWDTimerHandler.h" +#include "mcentrephandler.h" //Forward declaration class CWDTimer; +class CentrepMonitor; -class CWDMonitor : public CBase , public MWDTimerHandler +class CWDMonitor : public CBase , public MWDTimerHandler, public MCentrepHandler { public: /* @@ -52,6 +54,9 @@ // From MWDTimerHandler void HandleWDTimerL(); + //From MCentrepHandler + void HandlecentrepL( TUint32 aKey ); + private: /* * @description Starts the specified server. @@ -82,7 +87,16 @@ private: // Timer which is used to delay server monitoring - CWDTimer* iWDTimer; + CWDTimer* iWDTimer; + TBool iAllowHS; + TBool iAllowSS; + TUid iHSUid; + TUid iSSUid; + HBufC* iHSName; + HBufC* iSSName; + + CentrepMonitor* aHSMonitor; + CentrepMonitor* aSSMonitor; }; #endif /* CWDMONITOR_H */ diff -r cf5c74390b98 -r 3e1f76dd2722 watchdog/inc/mcentrephandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/watchdog/inc/mcentrephandler.h Thu Sep 02 21:37:32 2010 +0300 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This application is to monitor Harvester and Search Server +* +*/ + +#ifndef MCENTREPHANDLER_H +#define MCENTREPHANDLER_H + + +class MCentrepHandler + { +public : + /* + * HandleWDTimerL signal when the watchdog timer expires + */ + virtual void HandlecentrepL( TUint32 aKey ) = 0; + }; + + +#endif /* MCENTREPHANDLER_H */ diff -r cf5c74390b98 -r 3e1f76dd2722 watchdog/sis/watchdog.pkg.source --- a/watchdog/sis/watchdog.pkg.source Wed Aug 18 10:53:26 2010 +0300 +++ b/watchdog/sis/watchdog.pkg.source Thu Sep 02 21:37:32 2010 +0300 @@ -10,7 +10,7 @@ &EN ; standard SIS file header -#{"WatchDog"},(0x20029AB8),1,0,0, TYPE=SA;$(SVN) +#{"WatchDog"},(0x20029AB8),1,0,0, TYPE=SA,RU;$(SVN) ;Localised Vendor name %{"Nokia-EN"} @@ -25,7 +25,7 @@ ;You should change the source paths to match that of your environment ; -"$(EPOCROOT)epoc32\release\armv5\$(TARGET)\cpixwatchdog.exe" -"c:\sys\bin\cpixwatchdog.exe" +"$(EPOCROOT)epoc32\release\armv5\$(TARGET)\cpixwatchdog.exe" -"c:\sys\bin\cpixwatchdog.exe",FR,RI ; Watchdog is started at boot time - copy resource file ; must be hardcoded 'c' drive for this file diff -r cf5c74390b98 -r 3e1f76dd2722 watchdog/src/centrepmonitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/watchdog/src/centrepmonitor.cpp Thu Sep 02 21:37:32 2010 +0300 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This application is to monitor Harvester and Search Server + * +*/ + + +// Include Files +#include "WatchDogCommon.h" +#include "centrepmonitor.h" +#include +#include + +// ----------------------------------------------------------------------------- +// CentrepMonitor::NewL +// ----------------------------------------------------------------------------- +// +CentrepMonitor* CentrepMonitor::NewL( MCentrepHandler* aCentrepHandler, TUint32 aKey ) + { + CentrepMonitor* self = CentrepMonitor::NewLC( aCentrepHandler, aKey ); + CleanupStack::Pop(); + return self; + } + +// ----------------------------------------------------------------------------- +// CentrepMonitor::NewLC +// ----------------------------------------------------------------------------- +// +CentrepMonitor* CentrepMonitor::NewLC( MCentrepHandler* aCentrepHandler, TUint32 aKey ) + { + CentrepMonitor* self = new ( ELeave ) CentrepMonitor( ); + CleanupStack::PushL( self ); + self->ConstructL( aCentrepHandler, aKey ); + return self; + } + +// ----------------------------------------------------------------------------- +// CentrepMonitor::~CentrepMonitor() +// ----------------------------------------------------------------------------- +// +CentrepMonitor::~CentrepMonitor() + { + Cancel(); + delete aWDrepo; + } + +// ----------------------------------------------------------------------------- +// CentrepMonitor::CentrepMonitor() +// ----------------------------------------------------------------------------- +// +CentrepMonitor::CentrepMonitor( ): CActive( CActive::EPriorityStandard ) + { + + } + +// ----------------------------------------------------------------------------- +// CentrepMonitor::ConstructL() +// ----------------------------------------------------------------------------- +// +void CentrepMonitor::ConstructL( MCentrepHandler* aCentrepHandler, TUint32 aKey ) + { + CActiveScheduler::Add( this ); + iCentrepHandler = aCentrepHandler; + iKey = aKey; + aWDrepo = CRepository::NewL( KWDrepoUidMenu ); + } + +// ----------------------------------------------------------------------------- +// CentrepMonitor::RunL() +// ----------------------------------------------------------------------------- +// +void CentrepMonitor::RunL() + { + if ( iCentrepHandler ) + iCentrepHandler->HandlecentrepL( iKey ); + aWDrepo->NotifyRequest( iKey , iStatus ); + SetActive(); + } + +// ----------------------------------------------------------------------------- +// CentrepMonitor::DoCancel() +// ----------------------------------------------------------------------------- +// +void CentrepMonitor::DoCancel() + { + } + +// ----------------------------------------------------------------------------- +// CentrepMonitor::RunError() +// ----------------------------------------------------------------------------- +// +TInt CentrepMonitor::RunError( TInt ) + { + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CentrepMonitor::RunError() +// ----------------------------------------------------------------------------- +// +void CentrepMonitor::StartNotifier() + { + aWDrepo->NotifyRequest( iKey , iStatus ); + SetActive(); + } diff -r cf5c74390b98 -r 3e1f76dd2722 watchdog/src/cwdmonitor.cpp --- a/watchdog/src/cwdmonitor.cpp Wed Aug 18 10:53:26 2010 +0300 +++ b/watchdog/src/cwdmonitor.cpp Thu Sep 02 21:37:32 2010 +0300 @@ -19,6 +19,9 @@ #include "WatchDogCommon.h" #include "CWDTimer.h" #include +#include +#include +#include "centrepmonitor.h" #include "OstTraceDefinitions.h" #ifdef OST_TRACE_COMPILER_IN_USE #include "cwdmonitorTraces.h" @@ -52,6 +55,8 @@ // CWDMonitor::~CWDMonitor() { + delete iHSName; + delete iSSName; delete iWDTimer; } @@ -68,8 +73,52 @@ // ----------------------------------------------------------------------------- // void CWDMonitor::ConstructL() - { - iWDTimer = CWDTimer::NewL( this ); + { + CRepository* wdrepo = CRepository::NewL( KWDrepoUidMenu ); + wdrepo->Get( KHarvesterServerKey , iAllowHS ); + wdrepo->Get( KSearchServerKey , iAllowSS ); + + //get the UID's of the servers + TBuf temp; + TInt64 value; + TLex uidvalue; + //Read Harvester server UId value + if ( KErrNone == wdrepo->Get( KHarvesterServerUIDKey, temp ) ) + { + uidvalue.Assign(temp); + if (KErrNone == uidvalue.Val( value,EHex )) + iHSUid.iUid = value; + } + //Read Search server Uid value + if ( KErrNone == wdrepo->Get( KSearchServerUIDKey, temp )) + { + uidvalue.Assign(temp); + if (KErrNone == uidvalue.Val( value,EHex )) + iSSUid.iUid = value; + } + + //Read Harvester server Name + if ( KErrNone == wdrepo->Get( KHarvesterServerNAMEKey, temp )) + { + iHSName = HBufC::NewL( temp.Length() ); + TPtr hsname = iHSName->Des(); + hsname.Copy( temp ); + } + //Read Search server Name + if ( KErrNone == wdrepo->Get( KSearchServerNAMEKey, temp )) + { + iSSName = HBufC::NewL( temp.Length() ); + TPtr ssname = iSSName->Des(); + ssname.Copy( temp ); + } + delete wdrepo; + if ( iAllowHS || iAllowSS ) + iWDTimer = CWDTimer::NewL( this ); + + aHSMonitor = CentrepMonitor::NewL( this, KHarvesterServerKey); + aHSMonitor->StartNotifier(); + aSSMonitor = CentrepMonitor::NewL( this, KSearchServerKey); + aSSMonitor->StartNotifier(); } // ----------------------------------------------------------------------------- @@ -80,26 +129,26 @@ { OstTrace0( TRACE_NORMAL, CWDMONITOR_HANDLEWDTIMERL, "CWDMonitor::HandleWDTimerL(): Check the servers" ); CPIXLOGSTRING("CWDMonitor::HandleWDTimerL(): Check the servers"); - TFindServer harvesterServer(KHarvesterServer); - TFindServer searchServer(KSearchServer); + TFindServer harvesterServer(*iHSName); + TFindServer searchServer(*iSSName); TFullName name; - if ( harvesterServer.Next(name) != KErrNone) + if ( iAllowHS && (harvesterServer.Next(name) != KErrNone) ) { OstTrace0( TRACE_NORMAL, DUP1_CWDMONITOR_HANDLEWDTIMERL, "Harvester Server is down, Starting Harvester Server" ); CPIXLOGSTRING("Harvester Server is down, Starting Harvester Server"); //Harvester server is not running. //Start Harvester server - StartServer( KHarvesterServer , KHServerUid3 ,KHarvesterServerSemaphoreName); + StartServer( *iHSName , iHSUid ,KHarvesterServerSemaphoreName); } - else if ( searchServer.Next( name ) != KErrNone) + else if ( iAllowSS && (searchServer.Next( name ) != KErrNone) ) { OstTrace0( TRACE_NORMAL, DUP2_CWDMONITOR_HANDLEWDTIMERL, "Search Server is down, Starting Search Server" ); CPIXLOGSTRING("Search Server is down, Starting Search Server"); //Search server is not running. //Start search server - StartServer( KSearchServer , KSServerUid3 ,KSearchServerSemaphoreName); + StartServer( *iSSName , iSSUid ,KSearchServerSemaphoreName); } return; } @@ -163,4 +212,23 @@ return KErrNone; } +// ----------------------------------------------------------------------------- +// CWDMonitor::HandlecentrepL() +// ----------------------------------------------------------------------------- +// +void CWDMonitor::HandlecentrepL( TUint32 aKey ) + { + CRepository* wdrepo = CRepository::NewL( KWDrepoUidMenu ); + if ( KHarvesterServerKey == aKey ) + { + // get the harvester server status + wdrepo->Get( KHarvesterServerKey , iAllowHS ); + } + else if ( KSearchServerKey == aKey ) + { + // get the Search server status + wdrepo->Get( KSearchServerKey , iAllowSS ); + } + delete wdrepo; + } //End of file