|
1 /* |
|
2 * CCPixAbstractSearcher.h |
|
3 * |
|
4 * Created on: Oct 8, 2009 |
|
5 * Author: admin |
|
6 */ |
|
7 |
|
8 #ifndef CCPIXABSTRACTSEARCHER_H_ |
|
9 #define CCPIXABSTRACTSEARCHER_H_ |
|
10 |
|
11 #include <e32base.h> |
|
12 |
|
13 #include "cpixmaindefs.h" |
|
14 #include "cpixdoc.h" |
|
15 |
|
16 // FORWARD DECLARATIONS |
|
17 class CSearchDocument; |
|
18 class CCPixAsyncronizer; |
|
19 class MCPixAsyncronizerObserver; |
|
20 |
|
21 _LIT(KCpixDefaultSearchField, CPIX_DEFAULT_FIELD); |
|
22 |
|
23 class CCPixAbstractSearcher : public CBase |
|
24 { |
|
25 public: |
|
26 |
|
27 enum TQueryParser { |
|
28 EDatabaseQueryParser = 0, |
|
29 EIncrementalQueryParser = 1 |
|
30 }; |
|
31 |
|
32 |
|
33 public: |
|
34 |
|
35 virtual ~CCPixAbstractSearcher(); |
|
36 |
|
37 /** |
|
38 * Cancel any incomplete asyncronous operation |
|
39 * @param aMessage RMessage2 of CancelAll request |
|
40 */ |
|
41 virtual void CancelAll(const RMessage2& aMessage) = 0; |
|
42 |
|
43 /** |
|
44 * Search given terms from the default field. |
|
45 * @param aSearchTerms Terms to look for. |
|
46 * @param aObserver Observing object for this asyncronous call |
|
47 * @param aMessage The requesting message |
|
48 * @return ETrue if search was commited, EFalse if it was stop word for example and search was not commited |
|
49 */ |
|
50 virtual TBool SearchL(const TDesC& aSearchTerms, MCPixAsyncronizerObserver* aObserver, const RMessage2& aMessage) = 0; |
|
51 |
|
52 /** |
|
53 * Complete previous call to SearchL |
|
54 * @return Count of result documents. |
|
55 */ |
|
56 virtual TInt SearchCompleteL() = 0; |
|
57 |
|
58 /** |
|
59 * Gets document from the current search results. |
|
60 * @param aObserver Observing object for this asyncronous call |
|
61 * @param aMessage The requesting message |
|
62 * @parma aIndex index of the requested document |
|
63 */ |
|
64 virtual void GetDocumentL(TInt aIndex, MCPixAsyncronizerObserver* aObserver, const RMessage2& aMessage) = 0; |
|
65 |
|
66 /** |
|
67 * Complete the previous GetDocumentL |
|
68 * @return Document. Ownership is transferred to the caller of this function. |
|
69 */ |
|
70 virtual CSearchDocument* GetDocumentCompleteL() = 0; |
|
71 |
|
72 /** |
|
73 * Creates new database (and destroys existing) if path is given. Otherwise, opens existing database. |
|
74 * @param aDefaultSearchField Default field to which query results are looked from. |
|
75 * @param aBaseAppClass Application class of this database handle. |
|
76 * Defines which database this handle connects to. |
|
77 */ |
|
78 virtual void OpenDatabaseL(const TDesC& aSearchableId, const TDesC& aDefaultSearchField = KCpixDefaultSearchField) = 0; |
|
79 |
|
80 virtual void SetQueryParserL( TInt aQueryParser ) = 0; |
|
81 |
|
82 /** |
|
83 * IsOpen |
|
84 * @returns ETrue if the database is currently open |
|
85 */ |
|
86 virtual TBool IsOpen() = 0; |
|
87 |
|
88 /** |
|
89 * Sets the analyzer for this searcher. |
|
90 * |
|
91 * @param aAnalyzer analyzer definition string. See analyzer definition |
|
92 * syntax in the documentation |
|
93 */ |
|
94 virtual void SetAnalyzerL(const TDesC& aAnalyzer) = 0; |
|
95 |
|
96 public: |
|
97 |
|
98 static CSearchDocument* ConvertDocumentL( cpix_Document* aDocument ); |
|
99 |
|
100 }; |
|
101 |
|
102 |
|
103 #endif /* CCPIXABSTRACTSEARCHER_H_ */ |