~ubuntu-branches/ubuntu/saucy/goldencheetah/saucy

« back to all changes in this revision

Viewing changes to src/Lucene.h

  • Committer: Package Import Robot
  • Author(s): KURASHIKI Satoru
  • Date: 2013-08-18 07:02:45 UTC
  • mfrom: (4.1.8 sid)
  • Revision ID: package-import@ubuntu.com-20130818070245-zgdvb47e1k3mtgil
Tags: 3.0-3
debian/control: remove needless dependency. (Closes: #719571)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2012 Mark Liversedge (liversedge@gmail.com)
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify it
 
5
 * under the terms of the GNU General Public License as published by the Free
 
6
 * Software Foundation; either version 2 of the License, or (at your option)
 
7
 * any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful, but WITHOUT
 
10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 
12
 * more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License along
 
15
 * with this program; if not, write to the Free Software Foundation, Inc., 51
 
16
 * Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
17
 */
 
18
 
 
19
#ifndef _GC_Lucene_h
 
20
#define _GC_Lucene_h
 
21
 
 
22
#include <QObject>
 
23
#include <QString>
 
24
#include <QDir>
 
25
 
 
26
#include "MainWindow.h"
 
27
#include "RideMetadata.h"
 
28
#include "SummaryMetrics.h"
 
29
#include "RideFile.h"
 
30
 
 
31
#include "CLucene.h"
 
32
#include "CLucene/index/IndexModifier.h"
 
33
 
 
34
using namespace lucene::analysis;
 
35
using namespace lucene::index;
 
36
using namespace lucene::document;
 
37
using namespace lucene::queryParser;
 
38
using namespace lucene::search;
 
39
using namespace lucene::store;
 
40
 
 
41
class Lucene : public QObject
 
42
{
 
43
    Q_OBJECT
 
44
 
 
45
public:
 
46
    Lucene(QObject *parent, MainWindow *main);
 
47
    ~Lucene();
 
48
 
 
49
    // Create/Delete Metrics
 
50
        bool importRide(SummaryMetrics *summaryMetrics, RideFile *ride, QColor color, unsigned long, bool);
 
51
    bool deleteRide(QString);
 
52
    void optimise(); // for optimising the index once updated
 
53
 
 
54
    QStringList &files() { return filenames; }
 
55
 
 
56
protected:
 
57
 
 
58
public slots:
 
59
    // search
 
60
    int search(QString query); // run query and return number of results found
 
61
 
 
62
signals:
 
63
    void results(QStringList);
 
64
 
 
65
private:
 
66
    MainWindow *main;
 
67
    QDir dir;
 
68
 
 
69
    // CLucene objects
 
70
    lucene::analysis::standard::StandardAnalyzer analyzer;
 
71
 
 
72
    // Query results
 
73
    Hits *hits; // null when no results
 
74
    QStringList filenames;
 
75
};
 
76
 
 
77
#endif