fullText with multiple `or` throwing an error in parse server - parse-platform

Hi I am using fullText with multiple or statement but parse server throwing an error:
Here is my statement
var query1 = new Parse.Query("SearchTerms");
query1.fullText("searchString", searchTermArray[0]);
var query2 = new Parse.Query("SearchTerms");
query2.fullText("searchString", searchTermArray[1]);
var query3 = new Parse.Query("SearchTerms");
query3.fullText("searchString", searchTermArray[2]);
var query4 = new Parse.Query("SearchTerms");
query4.fullText("searchString", searchTermArray[3]);
var query5 = new Parse.Query("SearchTerms");
query5.fullText("searchString", searchTermArray[4]);
var query6 = new Parse.Query("SearchTerms");
query6.fullText("searchString", searchTermArray[5]);
var query7 = new Parse.Query("SearchTerms");
query7.fullText("searchString", searchTermArray[6]);
var query8 = new Parse.Query("SearchTerms");
query8.fullText("searchString", searchTermArray[7]);
orQuery = Parse.Query.or(query1, query2, query3, query4, query5, query6, query7, query8);
return motherQuery.matchesQuery(pattern, orQuery);
motherQuery.limit(1000);
motherQuery.find({
useMasterKey: true
})
Parse server throwing below error:
[31merror[39m: Error generating response. ParseError {
2019-11-25T08:46:46.632775+00:00 app[web.1]: code: 1,
2019-11-25T08:46:46.632776+00:00 app[web.1]: message: MongoError: Too many text expressions
2019-11-25T08:46:46.632778+00:00 app[web.1]: at queryCallback (/app/node_modules/mongodb-core/lib/cursor.js:247:25)
2019-11-25T08:46:46.632779+00:00 app[web.1]: at /app/node_modules/mongodb-core/lib/connection/pool.js:531:18
2019-11-25T08:46:46.632781+00:00 app[web.1]: at processTicksAndRejections (internal/process/task_queues.js:75:11) {
2019-11-25T08:46:46.632783+00:00 app[web.1]: name: 'MongoError',
2019-11-25T08:46:46.632784+00:00 app[web.1]: message: 'Too many text expressions',
2019-11-25T08:46:46.632785+00:00 app[web.1]: ok: 0,
2019-11-25T08:46:46.632787+00:00 app[web.1]: errmsg: 'Too many text expressions',
2019-11-25T08:46:46.632788+00:00 app[web.1]: code: 2,
2019-11-25T08:46:46.632789+00:00 app[web.1]: codeName: 'BadValue',
2019-11-25T08:46:46.632791+00:00 app[web.1]: operationTime: Timestamp { bsontype: 'Timestamp', low: 6, high_: 1574671603 },
2019-11-25T08:46:46.632792+00:00 app[web.1]: '$clusterTime': { clusterTime: [Timestamp], signature: [Object] },
2019-11-25T08:46:46.632793+00:00 app[web.1]: [Symbol(mongoErrorContextSymbol)]: {}
2019-11-25T08:46:46.632794+00:00 app[web.1]: }
Here is what I want:
I have a string column(wishlistSearchString) in table. and a search string (offerSearchString).
each word in wishlistSearchString is checked separately with all words in offerSearchString (no "exact" search, but "contains")
only if ALL words in wishlistSearchString have been found (AND) we have a match
wishlistSearchString "Picass" and offerSearchString "Picasso" is a match
wishlistSearchString "Picassoo" and offerSearchString "Picasso" is NOT a match
wishlistSearchString "Picass, painting" and offerSearchString "Picasso, painting" is a match
wishlistSearchString "Picass, painting" and offerSearchString "Picasso, Pablo, painting" is a match
wishlistSearchString "Picass, painting" and offerSearchString "Picasso, photography" is NOT a match
Based on the offer string I want to get records from table

Related

Using this.skip with cypress-json-failed results in: TypeError: Cannot read properties of undefined (reading 'message')

I am attempting to use a global beforeeach() algorithm defined in support/e2e to filter tests. This code works.
beforeEach(function () {
var testSuite = new Array();
testSuite = (Cypress.env('suites'));
if (!testSuite) {
return;
}
const testName = Cypress.mocha.getRunner().test.fullTitle().toLowerCase();
let matches = testSuite.some((value) => {
return (testName.includes(value))
});
if (!matches) {
this.skip();
}
return;
})
However, when using in conjunction with cypress-failed-log, tests that are skipped because of the prior algorithm are failing with this error:
TypeError: Cannot read properties of undefined (reading 'message')
Because this error occurred during a `after each` hook we are skipping all of the remaining tests.
at Context.onFailed (webpack:///./node_modules/cypress-failed-log/src/index.js:136:0)
This is what my plug in looks like. It works independent of the sorting algorithm and fails with the same message even if I only leave just the failed:required line and remove the code that uses the message object.
on('task', {
failed: require('cypress-failed-log/src/failed')()
,
log(message) {
console.log(message)
return null
},
table(message) {
console.table(message)
return null
}
})

i cannot connect to my DB(mongodb) when deploying with heroku, Error: Error connecting to db: connect ECONNREFUSED

I can't connect to my db,
i use mongodb atlas and heroku
first, my error code
2022-10-10T00:59:14.722647+00:00 heroku[web.1]: State changed from crashed to starting
2022-10-10T00:59:17.167527+00:00 heroku[web.1]: Starting process with command node app.js
2022-10-10T00:59:20.911026+00:00 heroku[web.1]: State changed from starting to up
2022-10-10T00:59:48.837201+00:00 app[web.1]: /app/node_modules/mongodb/lib/utils.js:365
2022-10-10T00:59:48.837215+00:00 app[web.1]: throw error;
2022-10-10T00:59:48.837216+00:00 app[web.1]: ^
2022-10-10T00:59:48.837216+00:00 app[web.1]:
2022-10-10T00:59:48.837217+00:00 app[web.1]: Error: Error connecting to db: connect ECONNREFUSED 127.0.0.1:27017
2022-10-10T00:59:48.837218+00:00 app[web.1]: at /app/node_modules/connect-mongodb-session/index.js:88:17
2022-10-10T00:59:48.837218+00:00 app[web.1]: at /app/node_modules/mongodb/lib/utils.js:361:17
2022-10-10T00:59:48.837219+00:00 app[web.1]: at
/app/node_modules/mongodb/lib/mongo_client.js:116:28
2022-10-10T00:59:48.837219+00:00 app[web.1]: at connectCallback
(/app/node_modules/mongodb/lib/operations/connect.js:29:9)
2022-10-10T00:59:48.837220+00:00 app[web.1]: at /app/node_modules/mongodb/lib/operations/connect.js:79:20
2022-10-10T00:59:48.837220+00:00 app[web.1]: at exitWithError (/app/node_modules/mongodb/lib/sdam/topology.js:186:53)
2022-10-10T00:59:48.837220+00:00 app[web.1]: at /app/node_modules/mongodb/lib/sdam/topology.js:190:59
2022-10-10T00:59:48.837221+00:00 app[web.1]: at /app/node_modules/mongodb/lib/sdam/topology.js:242:80
2022-10-10T00:59:48.837221+00:00 app[web.1]: at
2022-10-10T00:59:48.837221+00:00 app[web.1]:
2022-10-10T00:59:48.837222+00:00 app[web.1]: Node.js v18.7.0
2022-10-10T00:59:48.846833+00:00 heroku[router]: sock=backend at=error code=H18 desc="Server Request Interrupted" method=GET path="/" host=fast-retreat-13963.herokuapp.com request_id=76bb3f4b-344d-4207-b8e5-f82f0aa8a24c fwd="59.13.121.53" dyno=web.1 connect=0ms service=24199ms status=503 bytes= protocol=https
i use enviroment value in database
let mongodbUrl = process.env.MONGODB_URI;
if (mongodbUrl == null || mongodbUrl == "") {
mongodbUrl = "mongodb://127.0.0.1:27017";
}
async function connectToDatabse(){
const client = await MongoClient.connect(mongodbUrl)
database = client.db("shopping-project")
}
i igonre my node_modules to gitingore
/node_modules
npm-debug.log
.DS_Store
/*.env
herouku port
let port = process.env.PORT;
if (port == null || port == "") {
port = 3000;
}
db.connectToDatabse().then(function(){
app.listen(port)
}).catch(function(error){
console.log(error)
})
i resist Config Vars in heroku also
key
MONGODB_URI
value
mongodb+srv://audtlr:enterpassword#cluster0.mzdaqy1.mongodb.net/?retryWrites=true&w=majority
plase help me what im going to fix this...

exception is occuring when elastic server is missing

Below is the code for serilog elastic search.It's working perfectly when elastic service is running but fails when the server is not available
.WriteTo.Elasticsearch(new ElasticsearchSinkOptions(new Uri("http://localhost:9200/")) // humio elastic bulk endpoint
{
AutoRegisterTemplate = true,
OverwriteTemplate = true,
DetectElasticsearchVersion = true,
AutoRegisterTemplateVersion = AutoRegisterTemplateVersion.ESv7,
NumberOfReplicas = 1,
NumberOfShards = 2,
RegisterTemplateFailure = RegisterTemplateRecovery.FailSink,
FailureCallback = e => Console.WriteLine("Unable to submit event " + e.MessageTemplate),
EmitEventFailure = EmitEventFailureHandling.WriteToSelfLog |
EmitEventFailureHandling.WriteToFailureSink |
EmitEventFailureHandling.RaiseCallback,
//FailureSink = new FileSink("./fail-{Date}.txt", new JsonFormatter(), null, null)
//ModifyConnectionSettings = x => x.BasicAuthentication(username: "", password: "88WS28JEuB0G2WC3cYufdgTINAxOGQvliBrqH5Vqutjb") // password is ingest token from humio
})
exception is occuring when elastic server is missing
Elasticsearch.Net.ElasticsearchClientException: 'No connection could be made because the target machine actively refused it.. Call: Status code unknown from: GET /_cat/nodes?h=v'
HttpRequestException: No connection could be made because the target machine actively refused it.
SocketException: No connection could be made because the target machine actively refused it.
This exception was originally thrown at this call stack:
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
System.Net.Http.ConnectHelper.ConnectAsync(string, int, System.Threading.CancellationToken)

Google spreadsheet API throws "Unrecognized content type:application/binary"

Our system will check if worksheets exist or not before we insert our data to the sheet. However, some of our users will report seeing the error "Unrecognized content type:application/binary". What can be the issue?
This is the library we are using:
"com.google.gdata" % "core" % "1.47.1"
This is how we are calling it.
val service = new SpreadsheetService("getSpreadsheetInfo")
service.setProtocolVersion(SpreadsheetService.Versions.V3)
service.setOAuth2Credentials(
getCredentials(accessToken, refreshToken)
)
val worksheetOpt = getWorksheets(file.getId, service).find(_.getTitle().getPlainText() == SpreadsheetConstant.SPREADSHEET_NAME).getOrElse {
addDefaultWorksheet(file.getId, googleToken)
}
private def getWorksheets(spreadsheetId: String,
service: SpreadsheetService) = {
val feed = service.getFeed(getWorksheetFeedUrl(spreadsheetId), classOf[WorksheetFeed])
^^^^^^^
feed.getEntries.asScala
}
We occasionally get this following exception from getWorksheets -> service.getFeed().
com.google.gdata.util.ParseException: Unrecognized content type:application/binary
at com.google.gdata.client.Service.parseResponseData(Service.java:2136) ~[com.google.gdata.core-1.47.1.jar:na]
at com.google.gdata.client.Service.parseResponseData(Service.java:2098) ~[com.google.gdata.core-1.47.1.jar:na]
at com.google.gdata.client.Service.getFeed(Service.java:1136) ~[com.google.gdata.core-1.47.1.jar:na]
at com.google.gdata.client.Service.getFeed(Service.java:998) ~[com.google.gdata.core-1.47.1.jar:na]
at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:645) ~[com.google.gdata.core-1.47.1.jar:na]
at com.google.gdata.client.Service.getFeed(Service.java:1017) ~[com.google.gdata.core-1.47.1.jar:na]

How do I find out which column combinations are valid in adwords

I am using the adwords api to generate reports.
Please bear with me as I am not too familiar with the same.
I am using version v201409 of the api.
I get the report columns for KEYWORD_PERFORMANCE_REPORT using getReportFields.
I then try to download the report using a subset of those columns.
For KEYWORD_PERFORMANCE_REPORT I get the error:
Cannot select a combination of Device and
AssistClicks,AssistClicksOverLastClicks,AssistImpressions,AssistImpressionsOverLastClicks,AveragePageviews,AverageTimeOnSite,BounceRate,Bounces,ClickAssistedConversionValue,ClickAssistedConversionValueLong,ClickAssistedConversionValueNonMoney,ClickAssistedConversions,ClickAssistedConversionsOverLastClickConversions,ImpressionAssistedConversionValue,ImpressionAssistedConversionValueLong,ImpressionAssistedConversionValueNonMoney,ImpressionAssistedConversions,ImpressionAssistedConversionsOverLastClickConversions,LastClickConversions,LastClicks,NewVisitors,Pageviews,PercentNewVisitors,VisitDuration,Visits,
Type: ReportDefinitionError.INVALID_FIELD_NAME_FOR_REPORT.
The question is: How do I find out a valid set of combinations of columns without going through a trial and error process.. Is there any documentation which will help me with the same.
I looked at the columns for KEYWORD_PERFORMANCE_REPORT in http://developers.guge.io/adwords/api/docs/appendix/reports and exclude the colums which the api said were "not compatible". Got a similar error.
Thanks
N.B> If I try this code with the columns provided in the online example it works and downloads the report as expected.
The code is:
`
String[] columnNames = {
"ConversionRateManyPerClickSignificance",
"ConversionRateSignificance",
"ViewThroughConversionsSignificance",
"AccountCurrencyCode",
"AccountDescriptiveName",
"AccountTimeZoneId",
"AdGroupId",
"AdGroupName",
"AdGroupStatus",
"AssistImpressions",
"AssistImpressionsOverLastClicks",
"AverageCpc",
"AverageCpm",
"AveragePageviews",
"AveragePosition",
"AverageTimeOnSite",
"BiddingStrategyId",
"BiddingStrategyName",
"BiddingStrategyType",
"CampaignId",
"CampaignName",
"CampaignStatus",
"ClickAssistedConversionsOverLastClickConversions",
"ClickAssistedConversionValue",
"Clicks",
"ClickSignificance",
"ClickType",
"ConversionManyPerClickSignificance",
"ConversionRate",
"ConversionRateManyPerClick",
"Conversions",
"ConversionSignificance",
"ConversionsManyPerClick",
"ConversionTypeName",
"ConversionValue",
"Cost",
"CostPerConversion",
"CostPerConversionManyPerClick",
"CostPerConversionManyPerClickSignificance",
"CostPerConversionSignificance",
"CostSignificance",
"CpcBid",
"CpcBidSource",
"CpmBid",
"CpmSignificance",
"CriteriaDestinationUrl",
"Ctr",
"CtrSignificance",
"CustomerDescriptiveName",
"CvrSignificance",
"Date",
"DayOfWeek",
"Device",
"ExternalCustomerId",
"FinalAppUrls",
"FinalMobileUrls",
"FinalUrls",
"FirstPageCpc",
"Id",
"ImpressionAssistedConversions",
"ImpressionAssistedConversionsOverLastClickConversions",
"ImpressionAssistedConversionValue",
"Impressions",
"ImpressionSignificance",
"IsNegative",
"KeywordMatchType",
"LabelIds",
"Labels",
"Month",
"MonthOfYear",
"PlacementUrl",
"PositionSignificance",
"PrimaryCompanyName",
"QualityScore",
"Quarter",
"SearchExactMatchImpressionShare",
"SearchImpressionShare",
"SearchRankLostImpressionShare",
"Slot",
"TrackingUrlTemplate",
"UrlCustomParameters",
"ValuePerConversion",
"ValuePerConversionManyPerClick",
"ViewThroughConversions",
"Week",
"Year"
};
public static void downloadConsolidatedReportFile(String[] columnNames, final ReportDefinitionDateRangeType forDateRange, final ReportDefinitionReportType reportDefinitionReportType, final String to) throws Exception {
com.google.api.ads.adwords.lib.jaxb.v201409.Selector selector = new com.google.api.ads.adwords.lib.jaxb.v201409.Selector();
selector.getFields().addAll(Lists.newArrayList(columnNames));
ReportDefinition reportDefinition = new ReportDefinition();
reportDefinition.setReportName("Report " + reportDefinitionReportType.value() + " for dateRange " + forDateRange.value());
reportDefinition.setDateRangeType(forDateRange);
reportDefinition.setReportType(reportDefinitionReportType);
reportDefinition.setDownloadFormat(DownloadFormat.CSV);
ReportingConfiguration reportingConfiguration = new ReportingConfiguration.Builder()
.skipReportHeader(true)
.skipReportSummary(true)
.build();
session.setReportingConfiguration(reportingConfiguration);
reportDefinition.setSelector(selector);
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(to)));
String mccId = session.getClientCustomerId(); //The id from ads.properties file
Collection<Client> clientIds = getClientAccountIds(mccId);
try {
for (Client cl : clientIds) {
BufferedReader reader = null;
String customerId = cl.id;
String name = cl.name;
session.setClientCustomerId(cl.id);
try {
ReportDownloadResponse response =
new ReportDownloader(session).downloadReport(reportDefinition);
if (response == null || response.getHttpStatus() != 200) {
handleError(response);
}
BufferedInputStream bs = new BufferedInputStream(response.getInputStream());
reader = new BufferedReader(new InputStreamReader(bs));
String line = null;
log.info("getting " + reportDefinition.getReportType().value() + " for " + customerId+" "+name);
reader.readLine(); //Skip the first line of column names
while ((line = reader.readLine()) != null) {
bw.write(line + "\n");
}
} catch (DetailedReportDownloadResponseException e) {
log.error("An error was thrown downloading report for Customer id: " + customerId+" "+name, e);
//We have to do this as we have to filter out the mcc id. An exception is thrown by MCC id
if (e.getType().equals("ReportDefinitionError." + ReportDefinitionErrorReason.CUSTOMER_SERVING_TYPE_REPORT_MISMATCH.getValue())) {
continue;
} else {
throw e;
}
} catch (Exception e) {
log.error("An error was thrown downloading report for Customer id: " + customerId+" "+name, e);
throw e;
} finally {
if (reader != null) {
reader.close();
}
}
}
} finally {
if (bw != null) {
bw.flush();
bw.close();
}
}
}
`
None of the columns you mentioned in the comment below are used.
Check the following documentation.
https://developers.google.com/adwords/api/docs/appendix/reports/keywords-performance-report#activeviewcpm
For some fields "Not compatible with the following fields" option is provided. Click on that option to check the combinations that are not compatible
The following columns are not selectable in the Keywords Performance Report in v201409:
AssistClicksOverLastClicks
Bounces
ClickAssistedConversionValueLong
ClickAssistedConversionValueNonMoney
ImpressionAssistedConversionValueLong
ImpressionAssistedConversionValueNonMoney
LastClickConversions
LastClicks
NewVisitors
Pageviews
VisitDuration
Visits
Suggest you try removing them and trying again. Failing that, post some code so we can see how you are making the call.
For future reference the AdWords Ad Hoc Reporting docs provide a downloadable CSV file for each of the report types listing the allowed metrics, attributes and segments.
I got an same issue with you. And from my understandings, there's no API to identify which column combinations are valid in adwords so far.
So I check whether the combination is valid or not before download the file by requesting real AWQL.
If the dummy AWQL returns error such as Adwords: Reporting Error: HTTP code: 400, error type: 'ReportDefinitionError.INVALID_FIELD_NAME_FOR_REPORT', trigger: 'Cannot select a combination of ActiveViewCpm and ConversionCategoryName,ConversionTrackerId,ConversionTypeName', field path: 'ActiveViewCpm', then I modify the combination of columns by using the error details through trial and error.
I don't know if this is the best way...

Resources