summaryrefslogtreecommitdiff
path: root/src/mongo/db/fts/fts_spec.h
diff options
context:
space:
mode:
authorJason Rassi <rassi@10gen.com>2014-01-29 18:44:16 -0500
committerJason Rassi <rassi@10gen.com>2014-01-29 18:44:32 -0500
commitfc2cbaf512630326868d8c948e2524cc8a4328ee (patch)
treefd338315422fa983b0fac408717c0eb68bf87465 /src/mongo/db/fts/fts_spec.h
parenta195fdda02361abf7e74f8a99dc80550f46c2f84 (diff)
parent8afbec33f4de266a552f50c608621053523a7a15 (diff)
downloadmongo-fc2cbaf512630326868d8c948e2524cc8a4328ee.tar.gz
Merge branch 'paul/ftsiterator'
Conflicts: src/mongo/db/fts/fts_spec.cpp src/mongo/db/fts/fts_spec.h src/mongo/db/fts/fts_spec_test.cpp
Diffstat (limited to 'src/mongo/db/fts/fts_spec.h')
-rw-r--r--src/mongo/db/fts/fts_spec.h39
1 files changed, 17 insertions, 22 deletions
diff --git a/src/mongo/db/fts/fts_spec.h b/src/mongo/db/fts/fts_spec.h
index 570303f181b..f41238009fc 100644
--- a/src/mongo/db/fts/fts_spec.h
+++ b/src/mongo/db/fts/fts_spec.h
@@ -47,9 +47,9 @@ namespace mongo {
extern const double MAX_WEIGHT;
extern const double MAX_WORD_WEIGHT;
+ extern const double DEFAULT_WEIGHT;
typedef std::map<string,double> Weights; // TODO cool map
-
typedef unordered_map<string,double> TermFrequencyMap;
struct ScoreHelperStruct {
@@ -92,17 +92,10 @@ namespace mongo {
/**
* Calculates term/score pairs for a BSONObj as applied to this spec.
- * - "obj": the BSONObj to traverse; can be a subdocument or array
- * - "parentLanguage": nearest enclosing document "language" spec for obj
- * - "parentPath": obj's dotted path in containing document
- * - "isArray": true if obj is an array
- * - "term_freqs": out-parameter to store results
+ * @arg obj document to traverse; can be a subdocument or array
+ * @arg term_freqs output parameter to store (term,score) results
*/
- void scoreDocument( const BSONObj& obj,
- const FTSLanguage& parentLanguage,
- const string& parentPath,
- bool isArray,
- TermFrequencyMap* term_freqs ) const;
+ void scoreDocument( const BSONObj& obj, TermFrequencyMap* term_freqs ) const;
/**
* given a query, pulls out the pieces (in order) that go in the index first
@@ -110,7 +103,6 @@ namespace mongo {
Status getIndexPrefix( const BSONObj& filter, BSONObj* out ) const;
const Weights& weights() const { return _weights; }
-
static BSONObj fixSpec( const BSONObj& spec );
private:
@@ -119,13 +111,6 @@ namespace mongo {
//
/**
- * Get the language override for the given BSON doc. If no language override is
- * specified, returns currentLanguage.
- */
- const FTSLanguage& _getLanguageToUseV2( const BSONObj& userDoc,
- const FTSLanguage& currentLanguage ) const;
-
- /**
* Calculate the term scores for 'raw' and update 'term_freqs' with the result. Parses
* 'raw' using 'tools', and weights term scores based on 'weight'.
*/
@@ -134,6 +119,15 @@ namespace mongo {
TermFrequencyMap* term_freqs,
double weight ) const;
+ public:
+ /**
+ * Get the language override for the given BSON doc. If no language override is
+ * specified, returns currentLanguage.
+ */
+ const FTSLanguage* _getLanguageToUseV2( const BSONObj& userDoc,
+ const FTSLanguage* currentLanguage ) const;
+
+ private:
//
// Deprecated helper methods. Invoked for TEXT_INDEX_VERSION_1 spec objects only.
//
@@ -165,12 +159,13 @@ namespace mongo {
string _languageOverrideField;
bool _wildcard;
- // _weights stores a mapping between the fields and the value as a double
- // basically, how much should an occurence of (query term) in (field) be worth
+ // mapping : fieldname -> weight
Weights _weights;
- // other fields to index
+ // Prefix compound key - used to partition search index
std::vector<string> _extraBefore;
+
+ // Suffix compound key - used for covering index behavior
std::vector<string> _extraAfter;
};