<commit_before>var RavenRequest = require('./RavenRequest'),
	querystring = require('querystring'),
	inherits = require('util').inherits,
	format = require('util').format,
	NestedQuery = require('./NestedQuery'),
	filter = require('./filter.js'),
	_ = require('lodash'),
	inflect = require('i')();

var QueryRequest = module.exports = function(indexName, settings) {
	if (arguments.length < 2) {
		settings = indexName;
		indexName = undefined;
	}

	RavenRequest.call(this, settings);
	this.indexName = indexName;
	this.queryData = { };
};

inherits(QueryRequest, RavenRequest);

QueryRequest.prototype.collection = function(collectionName, pluralizeTypeName) {
	var self = this;
	if (_(self.indexName).isString()) throw new Error('Cannot specify both an index and collection to query.');
	if (pluralizeTypeName === true) collectionName = inflect.pluralize(collectionName);
	self.queryData.collection = inflect.camelize(inflect.underscore(collectionName), false);
	return this;
};

QueryRequest.prototype.lucene = function(luceneQuery) {
	var self = this;
	if (!_(luceneQuery).isString()) throw new Error('Expected a valid lucene query string.');
	if (!!self.queryData.fluentQuery) throw new Error(
		'Invalid usage. Cannot call query() simultaneously with where()');
	if (!!self.queryData.query) throw new Error(
		'Invalid usage. Cannot call query() multiple times');<commit_msg>Do not change case of collectionName in collection()<commit_after>var RavenRequest = require('./RavenRequest'),
	querystring = require('querystring'),
	inherits = require('util').inherits,
	format = require('util').format,
	NestedQuery = require('./NestedQuery'),
	filter = require('./filter.js'),
	_ = require('lodash'),
	inflect = require('i')();

var QueryRequest = module.exports = function(indexName, settings) {
	if (arguments.length < 2) {
		settings = indexName;
		indexName = undefined;
	}

	RavenRequest.call(this, settings);
	this.indexName = indexName;
	this.queryData = { };
};

inherits(QueryRequest, RavenRequest);

QueryRequest.prototype.collection = function(collectionName, pluralizeTypeName) {
	var self = this;
	if (_(self.indexName).isString()) throw new Error('Cannot specify both an index and collection to query.');
	if (pluralizeTypeName === true) collectionName = inflect.pluralize(collectionName);
	self.queryData.collection = collectionName;
	return this;
};

QueryRequest.prototype.lucene = function(luceneQuery) {
	var self = this;
	if (!_(luceneQuery).isString()) throw new Error('Expected a valid lucene query string.');
	if (!!self.queryData.fluentQuery) throw new Error(
		'Invalid usage. Cannot call query() simultaneously with where()');
	if (!!self.queryData.query) throw new Error(
		'Invalid usage. Cannot call query() multiple times');
{'fraction_non_alphanumeric': 0.1411465892597968, 'fraction_numerical': 0.000725689404934688, 'mean_word_length': 5.708029197080292, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3350397', 'n_tokens_mistral': 836, 'n_tokens_neox': 806, 'n_words': 217}