本文整理汇总了C++中TermFrequencyMap::size方法的典型用法代码示例。如果您正苦于以下问题:C++ TermFrequencyMap::size方法的具体用法?C++ TermFrequencyMap::size怎么用?C++ TermFrequencyMap::size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TermFrequencyMap
的用法示例。
在下文中一共展示了TermFrequencyMap::size方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: spec
TEST(FTSSpec, ScoreMultipleField1) {
BSONObj user = BSON("key" << BSON("title"
<< "text"
<< "text"
<< "text")
<< "weights"
<< BSON("title" << 10));
FTSSpec spec(assertGet(FTSSpec::fixSpec(user)));
TermFrequencyMap m;
spec.scoreDocument(BSON("title"
<< "cat sat run"
<< "text"
<< "cat book"),
&m);
ASSERT_EQUALS(4U, m.size());
ASSERT_EQUALS(m["sat"], m["run"]);
ASSERT(m["sat"] > 0);
ASSERT(m["cat"] > m["sat"]);
ASSERT(m["cat"] > m["book"]);
ASSERT(m["book"] > 0);
ASSERT(m["book"] < m["sat"]);
}
示例2: spec
TEST( FTSSpec, ScoreSingleField1 ) {
BSONObj user = BSON( "key" << BSON( "title" << "fts" <<
"text" << "fts" ) <<
"weights" << BSON( "title" << 10 ) );
FTSSpec spec( FTSSpec::fixSpec( user ) );
TermFrequencyMap m;
spec.scoreDocument( BSON( "title" << "cat sat run" ), &m );
ASSERT_EQUALS( 3U, m.size() );
ASSERT_EQUALS( m["cat"], m["sat"] );
ASSERT_EQUALS( m["cat"], m["run"] );
ASSERT( m["cat"] > 0 );
}
示例3: spec
TEST( FTSSpec, ScoreMultipleField2 ) {
// Test where one indexed field is a parent component of another indexed field.
BSONObj user = BSON( "key" << BSON( "a" << "text" << "a.b" << "text" ) );
FTSSpec spec( FTSSpec::fixSpec( user ) );
TermFrequencyMap m;
spec.scoreDocument( BSON( "a" << BSON( "b" << "term" ) ),
FTSLanguage::makeFTSLanguage( "english" ).getValue(),
"",
false,
&m );
ASSERT_EQUALS( 1U, m.size() );
}
示例4: spec
TEST( FTSSpec, NestedArraysPos2 ) {
BSONObj user = BSON( "key" << BSON( "$**" << "fts" ) );
FTSSpec spec( FTSSpec::fixSpec( user ) );
// The wildcard spec implies a full recursive traversal, so "term" should be indexed.
BSONObj obj = fromjson("{a: {b: [['term']]}}"); // directly nested arrays
TermFrequencyMap m;
spec.scoreDocument( obj,
FTSLanguage::makeFTSLanguage( "english" ).getValue(),
"",
false,
&m );
ASSERT_EQUALS( 1U, m.size() );
}