Solr: Synonyms using the Managed Resources REST API - rest

How do I change an initArgs value for Synonyms using the Managed Resources REST API?
In particular, I need to change the following:
"initArgs":{"ignoreCase":false}
... to true.
https://cwiki.apache.org/confluence/display/solr/Managed+Resources#ManagedResources-Synonyms
I don't see any mention in the documentation about changing initArgs.
You can edit the file directly after it has been created, but the docs explicitly say this is not the correct way to change data in this file. (it does work however).

found it. try&error style ;-)
curl -X POST -H 'Content-type:application/json' --data-binary '{"initArgs":{"ignoreCase":true}}' "http://<solr-host>/solr/<core>/schema/analysis/synonyms/german"

Related

How to get child elements that is not deleted using nuxeo rest endpoint?

When I call http://localhost:8080/nuxeo/api/v1/id/bad6cbc5-b75f-4373-981f-6908cec66779?enrichers.document=children endpoint it returns all child elements include deleted elements. But I need to get only active elements and I think I should add isTrashed=false query to endpoint. But http://localhost:8080/nuxeo/api/v1/id/bad6cbc5-b75f-4373-981f-6908cec66779?enrichers.document=children&isTrashed=false does not any effect. How can I get only active child elemets from nuxeo server using rest api?
/nuxeo/api/v1/id endpoint with children enricher does not support this kind of filtering.
I see two options:
Implement own enricher which will support filtering of trashed documents. children enricher is implemented by org.nuxeo.ecm.core.io.marshallers.json.enrichers.ChildrenJsonEnricher class so you can inspire there how to do that.
Use different end point with page provider which supports filtering of trashed documents:
/nuxeo/api/v1/search/pp/advanced_document_content/execute?&ecm_parentId=bad6cbc5-b75f-4373-981f-6908cec66779&ecm_trashed=false
Benefits of the second option:
paging - simply add currentPageIndex=0&offset=0&pageSize=20 to the query
properties - you can define what properties do you need by adding of header: properties:dublincore,common,uid,file
enrichers - it means that you can use enrichers for each child and receive for example permission or thumbnail URL for each child. To do that add this header: enrichers-document: thumbnail, permissions
Example curl call:
curl -X GET -u Administrator:Administrator \
-H "properties:dublincore,common,uid,file" \
-H "enrichers-document: thumbnail, permissions" \
"http://localhost:8080/nuxeo/api/v1/search/pp/advanced_document_content/execute?&ecm_parentId=bad6cbc5-b75f-4373-981f-6908cec66779&ecm_trashed=false" | jq

ServiceNow Rest API call

I am trying to use a between operator as below,
curl -k "https://instance.service-now.com/api/now/table/My_Table?sysparm_query=sys_updated_on>javascript:gs.dateGenerate('2017-12-06','14:45:23')^sys_updated_on<javascript:gs.dateGenerate('2017-12-08','14:45:23')" --request GET --header "Accept:application/json" --user 'My Username':'My Password'
The output that I get is not in between the specified date Limit. Is there anything that I am doing wrong with the Command. Is the above command built correctly?I am stuck with this and trying different ways. Can anybody help me?
I recommend using the BETWEEN query operator.
sysparm_query=sys_updated_onBETWEENjavascript:gs.dateGenerate('2017-12-06','14:45:23')#javascript:gs.dateGenerate('2017-12-08','14:45:23')
You should then URL-encode the query to make sure none of your characters would cause an issue:
sys_updated_onBETWEENjavascript%3Ags.dateGenerate(%272017-12-06%27%2C%2714%3A45%3A23%27)%40javascript%3Ags.dateGenerate(%272017-12-08%27%2C%2714%3A45%3A23%27)
Pro-tip: You can actually just go to the table and run the exact query you want to run, then right-click the query breadcrumb and click "Copy query" to get the exact query syntax you want.
More on this in my book: Learning ServiceNow. For a more advanced and shorter compendium of ServiceNow best-practices, pro-tips, and guidelines, check out my latest book: The ServiceNow Development Handbook.

In Spring data rest is possible to add nested #OneToMany object to parent over POST /parent/{parentId}/nested?

I have Parent and Nested objects. I can get list of nested, using GET /parent/{parentId}/nested but I cannot POST/PUT to it with success. On POST result I get HTTP 204 and parent have empty list of nested objects.
In logs I see that Hibernate do not insert anything in DB.
During debugging I see that Jackson Object Mapper for deserealization getting "org.springframework.hateoas.Resources<java.lang.Object>" as JavaType.
Here is real example of my POST:
curl 'http://localhost:8000/api/users/402880e554b8f7960154b8f7adbc0000/orders/' -i -X POST -H 'Authorization: Basic OLOLO==' -H 'Accept: application/json' -H 'deviceCurrencyCode: USD' -H 'Content-Type: application/json; charset=UTF-8' -d '{"orderPrice": 0,"tax": 0,"shippingCost": 0,"credits": 0,"addresses": [{"firstName": "Figli","lastName": "Migli","zipCode": "5555","city": "Riga","country": "Tlmltr","phone": "7777","address": "Adddr"}],"status": "status"}'
I know that it is possible to do POST /nested '{"parent":"/link/to/parent"}'. But if it is way to GET nested objects over parent, why I cannot POST/PUT/PATCH them this way? I checked, is it RESTfull, and seems it is.
There is a a section "The association resource" in the spring data rest documentation that tells you what is possible on this resource. And creating a new child and associating it is not possible.
I do not know the why this is.
The only way (I know of) to get this behaviour is to implement a custom controller that does that for you. (Make sure you do not use the #RequestMapping annotation on class level on your custom controller to not override more spring data rest functionality than you want to)

How to list objects and (virtual directorys) using the REST API for OpenStack Object Store(Swift)

we use the REST API for OpenStack Object Store(Swift).
guessing the following structure does exist in the OpenStack Object Store:
/containername/object1.txt
/containername/object2.txt
/containername/pseudo-directoryname/object3.txt
/containername/pseudo-directoryname/object4.txt
To get a list of objects from a container we can use a HTTP GET request with the specified URL.
So far so good. Result:
/object1
/object2.txt
/pseudo-directoryname/object3
/pseudo-directoryname/object4.txt
The GET request combined with a delimiter parameter ("URL+ABSOLUTEPATH?delimiter=/") cuts the pseudo directories from the result.
/object1.txt
/object2.txt
I would like to have a list of all objects within the container combined with the pseudo directories within the container.
Is there a solution to get the following result without getting all objects and parse them on client side?
/object1.txt
/object2.txt
/pseudo-directoryname/
I didn't find anything about wildcards when using the delimiter parameter.
Something like "URL+ABSOLUTEPATH?delimiter=/*/".
I was just trying to work the same thing out. Found the answer in the docs: http://docs.openstack.org/user-guide/cli_swift_pseudo_hierarchical_folders_directories.html#list-pseudo-hierarchical-folders-request-http
Using their example (note the prefix and delimiter query string parameters):
$ curl -X GET -i -H "X-Auth-Token: $token" $publicurl/v1/AccountString/backups?prefix=photos/&delimiter=/
Would return:
photos/animals/
photos/me.jpg
photos/plants/

Facebook Ads API: What is 'location' parameter in the call for a Reach estimate

I'm attempting to work with the reachestimation objects defined at http://developers.facebook.com/docs/reference/ads-api/reachestimate/.
Both the bid estimation and impression estimation that are part of the reach estimate contain an entry for location that is given with a simple integer.
I've searched throughout the documentation and can't find any listing of what these numbers correspond to.
Does anyone know where I can find this information and/or what the different values are for?
If they're not documented, it's probably a bad idea to rely on them, but it refers to the different locations on Facebook in which the ad will be shown.
I don't know which values correspond to which locations, but presumably one refers to News Feed and one refers to the normal right-hand-side ads bar
You can search for mapping between the location name and the integer by using the adgeolocation endpoint. Here's the curl example:
curl -G \
-d "type=adgeolocation" \
-d "q=Washington" \
-d "location_types=['city']" \
-d "access_token=XYZ" \
https://graph.facebook.com/v2.3/search