Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
variety
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-gitdep
variety
Commits
71a49107
Commit
71a49107
authored
Aug 30, 2013
by
rugbyhead
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ES: adding ability to pass a query to the script to further filter the set of documents analyzed
parent
4cde56e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
variety.js
variety.js
+6
-3
No files found.
variety.js
View file @
71a49107
...
@@ -51,7 +51,10 @@ if (db[collection].count() == 0) {
...
@@ -51,7 +51,10 @@ if (db[collection].count() == 0) {
"Possible collection options for database specified: "
+
collNames
+
"."
;
"Possible collection options for database specified: "
+
collNames
+
"."
;
}
}
if
(
typeof
limit
===
"undefined"
)
{
var
limit
=
db
[
collection
].
count
();
}
if
(
typeof
query
===
"undefined"
)
{
var
query
=
{};
}
print
(
"Using query of "
+
query
.
toSource
());
if
(
typeof
limit
===
"undefined"
)
{
var
limit
=
db
[
collection
].
find
(
query
).
count
();
}
print
(
"Using limit of "
+
limit
);
print
(
"Using limit of "
+
limit
);
if
(
typeof
maxDepth
===
"undefined"
)
{
var
maxDepth
=
99
;
}
if
(
typeof
maxDepth
===
"undefined"
)
{
var
maxDepth
=
99
;
}
...
@@ -182,7 +185,7 @@ var addVarietyResults = function(result) {
...
@@ -182,7 +185,7 @@ var addVarietyResults = function(result) {
}
}
// main cursor
// main cursor
db
[
collection
].
find
().
sort
({
_id
:
-
1
}).
limit
(
limit
).
forEach
(
function
(
obj
)
{
db
[
collection
].
find
(
query
).
sort
({
_id
:
-
1
}).
limit
(
limit
).
forEach
(
function
(
obj
)
{
var
recordResult
=
{};
var
recordResult
=
{};
for
(
var
key
in
obj
)
{
for
(
var
key
in
obj
)
{
if
(
obj
.
hasOwnProperty
(
key
))
{
if
(
obj
.
hasOwnProperty
(
key
))
{
...
@@ -229,7 +232,7 @@ resultsDB[resultsCollectionName].find({}).forEach(function(key) {
...
@@ -229,7 +232,7 @@ resultsDB[resultsCollectionName].find({}).forEach(function(key) {
if
(
limit
<
numDocuments
)
{
if
(
limit
<
numDocuments
)
{
var
existsQuery
=
{};
var
existsQuery
=
{};
existsQuery
[
keyName
]
=
{
$exists
:
true
};
existsQuery
[
keyName
]
=
{
$exists
:
true
};
key
.
totalOccurrences
=
db
[
collection
].
count
(
existsQuery
);
key
.
totalOccurrences
=
db
[
collection
].
find
(
query
).
count
(
existsQuery
);
}
}
key
.
percentContaining
=
(
key
.
totalOccurrences
/
numDocuments
)
*
100.0
;
key
.
percentContaining
=
(
key
.
totalOccurrences
/
numDocuments
)
*
100.0
;
resultsDB
[
resultsCollectionName
].
save
(
key
);
resultsDB
[
resultsCollectionName
].
save
(
key
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment