Can you custom file sort in vs code? - sorting

Is there any way to custom sort files\folders in vs code? As an example if I have the following files which are in the default sort order...
1-safe_one.js
1-search_one.js
2-safe_two.js
2-search_two.js
3-safe_three.js
3-search_three.js
But I want to ignore the number-hyphen prefix so the sort order would be...
1-safe_one.js
2-safe_two.js
3-safe_three.js
1-search_one.js
2-search_two.js
3-search_three.js
Thanks

Related

How to retain order of translations with FormatJS CLI?

When the messages are extracted they are ordered in the extraction file alphabetically according to their randomly generated ids. Is there any way to prevent that and have them ordered in the exact same order in which they appear in the code instead?
E.g. now:
"AYGNrK": translation2,
"BIOgfm": translation1,
"Cqv/CV": translation3,
Wanted:
"BIOgfm": translation1,
"AYGNrK": translation2,
"Cqv/CV": translation3,
If you want to have full control over the exported message, you can use your own formating function.
formatjs extract "src/**/*.{ts,tsx,vue}" --format [path]
In this function, you can sort it i.e. by value. See this example for the general structure of a custom formatter:
https://github.com/formatjs/formatjs/blob/main/packages/cli/src/formatters/default.ts
An altnerative way is to set the custom id with a prefix instead of generating ids. But you need to be aware of naming collisions.
<FormattedMessage
id="component.title"
value="My title"
/>

How to perform Sorting using flow steps in WebMethods (Software AG)?

I am new to this Middleware and I tried my level best to perform sorting using the flow steps in designer but couldn't make it.Can anybody help me out by giving me direction for how to complete my work?(like the flow steps in order and where i can put the conditions and all)
Thanks.
No need to over-complicate it - use the utilities - pub.document:sortDocuments is what you are looking for.
If you receive stringList as input - convert this into a documentList. This can be done using pub.list:stringListToDocumentList (set the key to 'value')
Use pub.document:sortDocuments to sort the documentList. Remember to specify the key as 'value' once again and compareStringAs as 'numeric'. The order can also be set (ascending/descending)
What do you want to Sort? For Document-Lists you will find a built-in services in the WmPublic Folder.
For String-Lists i would use a Java-Service for Sorting.
Logic behind Sorting in webMethods is same as all other languages. You need LOOP to iterate every string in stringList, BRANCH to compare the two number and then map to the compare result to new StringList.
What format do you have the numbers in? Are they in a flat file or in a string list etc.

How to ignore "stop words" while sorting in MarkLogic?

Is there any way to ignore "stop words" while sorting.
For example:
I have words like
dixit
singla
the marklogic
On sorting in descending order the result should be
singla, the marklogic, dixit
As in the above example the is ignored.
Any way to achieve this?
Update:
Stop word can occur at any place.
for example
the MarkLogic
MarkLogic is the best
the MarkLogic is awesome
while sorting should not consider any stop word in the text.
Above is just a small example to describe the problem.
In actual I am using search:search API.
For sorting, I am using sort-order search options.
The element on which I have to perform sorting is dynamic. There are approx 30-35 elements.
Is there any way to customize the collation at this level like to configure some words (stop words) which will be ignored while sorting.
There is no standard collation URI that is going to do this for you (at least none that I've ever seen). You can do it dynamically, of course, by sorting on the result of a function invocation, but if you want it done efficiently at scale (and available to search:search), then you need to materialize the sortable string into your document. I've often done this as an attribute on the element:
<title sortable="Great Gatsby, The">The Great Gatsby</title>
Then you put a range index on the title/#sortable attribute.
You can also use the "envelope pattern" where materialized metadata like this is maintained in its own section of the document with the original kept in its own section. For things like this, I think it's a bit more elegant to decorate the elements directly, to keep the context.
If I understand your question correctly you're trying to get rid of the definite article when sorting your result-set.
In order to do this you need to use some additional functions and create a 'sort' criteria. My solution would look like this (I'm also including some sample documents so that you can test this just by copy-pasting):
(:
xdmp:document-insert("/peter.xml", <person><firstName>Peter</firstName><lastName>O'Toole</lastName><age>60</age></person>);
xdmp:document-insert("/john.xml", <person><firstName>John</firstName><lastName>Adams</lastName><age>18</age></person>);
xdmp:document-insert("/simon.xml", <person><firstName>Simon</firstName><lastName>Petrov</lastName><age>22</age></person>);
xdmp:document-insert("/mark.xml", <person><firstName>Mark</firstName><lastName>the Lord</lastName><age>25</age></person>);
:)
for $person in /person
let $sort := fn:reverse(fn:tokenize($person/lastName, ' '))[1]
order by $sort
(: return $person :)
return $person/lastName/text()
Notice that now the sort order is going to be
- Adams
- the Lord
- O'Toole
- Petrov
I hope this will help.

Is it possible to sort by 2+ fields using json.facet?

I'm using the following json.facet query:
{buckets:
{terms:
{field:outlet,
limit:10,
sort:{numberofhits:desc},
facet:
{numberofhits:'sum(numberofhits)',
mediavalue:'sum(mediavalue)',
audience:'sum(audience)',
positivesentiment:'sum(positivesentiment)',
negativesentiment:'sum(negativesentiment)',
dmaid:'max(dmaid)',
actorfriendscount:'sum(actorfriendscount)'}}}}
Everything works great, except that I want to be able to sort by numberofhits and then by the document count. I thought that, since document count is the default sort, this would happen automatically. But what it's actually doing is sorting by numberofhits and then by outlet alphabetically.
I tried sort:{numberofhits:desc,count:desc}, but it ignores the second one. Is there any way to specify two sort fields?

dam search/sort based on file size

How can I sort my search based on file size in DAM.
I'm trying this and the sorting doesn't seem to work maybe because dam:size is a string:
type=dam:Asset
path=/content/dam/<my_project>
nodename=*.pdf
orderby=#jcr:content/metadata/dam:size
orderby.sort=desc
With XPath, you can do it like this:
/jcr:root/content/dam/<site>//element(*,dam:Asset) order by jcr:content/metadata/#dam:size descending

Resources