1 |
|
/* ============================================================================ |
2 |
|
* Douglas Thrift's Search Engine License |
3 |
|
* |
4 |
< |
* Copyright (C) 2002, Douglas Thrift. All Rights Reserved. |
4 |
> |
* Copyright (C) 2002-2004, Douglas Thrift. All Rights Reserved. |
5 |
|
* Redistribution and use in source and binary forms, with or without |
6 |
|
* modification, are permitted provided that the following conditions are met: |
7 |
|
* |
46 |
|
// |
47 |
|
// Douglas Thrift |
48 |
|
// |
49 |
< |
// Ranker.h |
49 |
> |
// $Id$ |
50 |
|
|
51 |
< |
#ifndef _Ranker_h_ |
52 |
< |
#define _Ranker_h_ |
51 |
> |
#ifndef _Ranker_hpp_ |
52 |
> |
#define _Ranker_hpp_ |
53 |
|
|
54 |
< |
#include "Search.h" |
55 |
< |
#include "Page.h" |
54 |
> |
#include "Search.hpp" |
55 |
> |
#include "Page.hpp" |
56 |
|
|
57 |
|
class Ranker : public Page |
58 |
|
{ |
59 |
|
private: |
60 |
|
enum state { all, title, url, text }; |
61 |
+ |
enum { sampleMax = 160 }; |
62 |
|
string sample; |
63 |
|
map<unsigned, unsigned> occurrencesTitle; |
64 |
|
map<unsigned, unsigned> occurrencesDescription; |
94 |
|
unsigned evaluate(vector<unsigned>& ins); |
95 |
|
void decrap(string& crap); |
96 |
|
public: |
97 |
< |
Ranker(); |
98 |
< |
Ranker(Page& page); |
97 |
> |
Ranker(Page& page) : Page(page), value(0), requiredValue(0), |
98 |
> |
excludedValue(0), eitherOrValue(0), allIn(all) {} |
99 |
|
~Ranker() {} |
100 |
|
void rank(vector<string> query); |
101 |
|
void setSample(); |
102 |
|
string getTitle(); |
103 |
|
string getDescription(); |
104 |
< |
string getSample() { return sample; } |
104 |
> |
string& getSample() { return sample; } |
105 |
|
bool operator==(const unsigned number) const; |
106 |
|
bool operator==(const Ranker& ranker) const; |
107 |
|
bool operator!=(const unsigned number) const; |