Search and filter onedrive request - azure

I am trying to search for only folders with specific name, so I am using search and filter parameters. According to this search docs the search query should look like this:
GET /drive/root/search(q='vacation')
But if I want to add filter then according to this filter docs I should add filter=folder ne null but problem is how do I add It to original string ? In filter docs there is example of request
GET /drive/root/search?q=vacation&filter=image%20ne%20null%20and%20file%20ne%20null
which uses different syntax then example from search docs, and If I try to change It to my use like this
GET /drive/root/search?q=folderName&filter=folder ne null then I get 400 bad request reponse. So how can I search for specific item that is only folder ? thanks.

I wish I could comment, all you need to do is UrlEncode your parameters, quoting from the search doc.
Note: Samples omit proper URL encoding for readability. Actual filter syntax usage must be URL encoded.
For filter=folder ne null
This is what you should do append to url
filter%3Dfolder+ne+null

Related

How to setup Solr search across REST urls

We are implementing an API Portal and have a field named basePath to hold the base part of the api's rest url. Currently the field is defined as a string mapped to solr.StrField but we have search problems with this.
The problem right now is that in order to find an API by the basePath, we need double quote the value in the search. For example name:"/v1/api-proxy/generator" We cannot use name:/v1/api-proxy/* to see other apis that might have clashing urls. We know we have other urls like '/v1/api-proxy/validator' but something like name:/v1/api-proxy/* doesn't return any hits.
I am guessing a first step is to change away from 'string' to text or text_general, but how can search and find other hits that closely match the provided basePath?

Calling SharePoint Online REST API returns ? instead of umlaut

When I call SharePoint Online REST API to lookup a list item any values returns that contain umlauts are substituted for questions marks (?)
this is the URL i tried
e.g. https://<tenant>.sharepoint.com/sites/<sitename>/_api/lists/getbytitle('<listname>')/items?$select=Title,Id,Hashcode,Filename,Title/Title&$filter=(guid eq '62f0ff31-3d20-478a-a0d7-19f2d5709e71')
e.g EU-Konformitätserklärung_de,en.pdf is returned as EU-Konformit?tserkl?rung_de,en.pdf
What am I missing?
This might help-https://www.outsystems.com/forums/discussion/16634/rest-encoding-problem/
you will need to specify the encoding as utf-8

Marklogic : "highlight" seem not work withe Node.js and QueryBuilder

I try to get an extract of the text with the searched words highlighted on a JSON collection.
My search syntax is:
qb.word(qb.field('doc_text'),vartxt)
With 'doc_text' declared as field
(field type: root, include root: false, includes: doc_text), in an Node.js application.
The search works well, and it is done well on this field ...
But in txt[0].results[kl].matches[0]['match-text'], I find the first 3 properties of the JSON,
and not an extract from 'doc_text' with the words found.
I have another application in which the highlights work correctly, but it is based on XML.
Did I forget something in the field declaration, or is the operation different between JSON
and XML data, or is the highlight system not running on JSON via Node.js and QueryBuilder ?
Kind regards
Fields do not work quite the same way in XML and JSON. I think you're running into this limitation:
http://docs.marklogic.com/guide/app-dev/json#id_24090
The value of a field in XML can be the concatenation of all the text nodes, but the same does not apply in JSON.
I think I understood !!!
This query gives a correct snippet, with the extract and the words highlighted :
mkcq.and(mkcq.collection('document'), mkcq.word(mkcq.field('doc_text'), 'connaitre'))
On the other hand, this query gives the first 3 fields of the JSON :
mkcq.and(mkcq.collection('document'), mkcq.word(mkcq.field('doc_text'), 'connaitre'), mkcq.value(mkcq.element('','doc_user'), 'mbp'))
I do not know if this is normal or not, but it should be able to be corrected either by a simplified query and a selection on the returned records, evening by a particular snippeter.
Kind regards

querieng document which doesn't have a given field or is empty string in Solr

I am doing a query with solr where I need to find documents without a given field say 'name' and I am trying following part;
$q=+status:active -name:["" TO *]'
But it sends both all the documents with and without that field.
Can anyone help me figure this out?
the field name is a normal String type and is indexed.
I am using nodejs. Can anyone help me with this
According to docs:
-field:[* TO *] finds all documents without a value for field
Update
I tried it but it sends even the ones with the field non empty
Then my wild quess is that you are using search query q instead of using filter query fq. Since you are using multiple statements in query I assume that q does some extra magic to get the most relevant documents for you, which can lead to returning some non-wanted results.
If you want to get the strict set of results you should use filter query fq instead, see docs.

CAML Query with Contains and Or Clause Issue

What I want to achieve : Take a keyword array as input and query Sharepoint List to return all rows which contain the keywords in the list.
I have built a simple CAML query to query my list with one keyword (pdf) .
<Query><Where><Contains><FieldRef Name='Keyword'/><Value Type='Text'>pdf</Value></Contains></Where></Query>
This works fine.
But, when I try to use Or clause in the CAML query(see below), I get the following error
"One or more field types are not installed properly. Go to the list settings page to delete these fields."
<Query><Where><Or><Contains><FieldRef Name='Keyword'/><Value Type='Text'>pdf</Value></Contains></Or></Where></Query>
I googled for the syntax and everything looks good. Please let me know what is missing.
Thanks in advance.
In CAML Query if you want to use OR you must and should have 2 conditions.
The field reference name must be the internal name. You can find this by going to the colmn page in list/library settings and the name is the end of the URL. Spaces and underscores in the name must be handled differently.

Resources