Grouping of operators not working

Tagged:

Currently contains 6 posts

Avatar

April 17, 2015 19:11

jcbasson

Hi,
My Query parameter looks like this “JobTitle eq Accounting Specialist AND (CompanyId eq 777845157347735 ) AND (City eq Hagerstown )”
and it throws 500 server error that tells me <ExceptionMessage>Missing Logical Operator in query</ExceptionMessage>.
What am I doing wrong?

Avatar

April 20, 2015 13:36

Wayne-PCRecruiter

I could not get an error to throw in the REST API for these queries. Below is what I entered. Could you send me the full URL you submitted (along with however you encoded the URL). I added some additional information below.

The extra parenthesis are not needed in this query, you would want to write it as follows (not url encoded):
…/positions?query=JobTitle eq Account Specialist AND CompanyID eq 777845157347735 AND City eq Hagerstown

The use of the groupings would be for something like the following(not url encoded):
…/positions?query=JobTitle eq Account Specialist AND CompanyID eq 777845157347735 AND (City eq Hagerstown OR City eq Cleveland)

Avatar

April 20, 2015 14:15

jcbasson

…/positions?query=JobTitle eq Accounting Specialist AND (CompanyId eq 200382421531880 OR CompanyId eq 107042771304894 ) AND City eq Hagerstown encodes to:

http://www.pcrecruiter.net/rest/api/positions?SessionId=KjBU0g2XTlt0SknE5iCX34BXuuBrebrDPE5uFZLH%2F0nepXwjaKg%2BhOKrVWWOMf%2FStVAMOdjRTBWAxz8%3D&Fields=JobId%2CJobTitle%2CCompanyName%2CCity%2CState%2CJobType%2CJobDescription%2CCompanyId&Query=JobTitle+eq+Accounting+Specialist++AND+(CompanyId+eq+200382421531880+OR+CompanyId+eq+107042771304894+)+AND+City+eq+Hagerstown+&Order=JobTitle+DESC

and this is my code with the query string hard coded:

var params = { SessionId: accessToken, Fields: ‘JobId,JobTitle,CompanyName,City,State,JobType,JobDescription,CompanyId’, Query: ‘JobTitle eq Accounting Specialist AND (CompanyId eq 200382421531880 OR CompanyId eq 107042771304894 ) AND City eq Hagerstown’, Order: ‘JobTitle DESC’ }; $.ajax({ url: serviceBase + ‘positions’, method: “GET”, data: params, success: function (data) { if (data) { localStorageService.set(‘positions’, data.Results); $rootScope.$apply(function () { $location.path(‘/searchResults’); }); } } })

Avatar

April 20, 2015 16:08

Wayne-PCRecruiter

I believe the problem is with the additional space at the end of your grouping. When I removed this space I was able to get my request to work.
(CompanyId+eq+200382421531880+OR+CompanyId+eq+107042771304894+)
(CompanyId+eq+200382421531880+OR+CompanyId+eq+107042771304894)

Avatar

April 21, 2015 12:21

jcbasson

Thanks a million!That sorted the problem out!

Avatar

April 21, 2015 14:10

Wayne-PCRecruiter

You are welcome. Please let me know if you have any other issues.

Reply to thread