I want to insert an element into a list in a specific position. I don't want to replace the previous element but rather push everything forward. Is there a way to do this natively in the cassandra or must I take the list out and rewrite it?
thank you.
from the datastax documentation:
Add an element at a particular position using the list index position in square brackets
UPDATE users SET top_places[2] = 'riddermark' WHERE user_id = 'frodo';
When you add an element at a particular position, Cassandra reads the entire list, and then writes only the updated element. Consequently, adding an element at a particular position results in greater latency than appending or prefixing an element to a list.
I don't want to replace the previous element but rather push everything forward
You can't do that, you need to read and rewrite the entire list
Related
Hello i want to ask what exactly this Xpath does if we use.
I understand that it selects all b nodes that appear before the current node and that are not the same with current node.
//b[not(preceding::*=.)]
So if xml is like:
<a>
<b>English</b>
<b>German</b>
<b>Italian</b>
<b>Belarusian</b>
<b>Russian</b>
<b>Bulgarian</b>
<b>French</b>
<b>English</b>
</a>
Does this keep the last occurrence of the node or the first? this is what i do not get.
I was thinking that it should keep the last but using this xpath in FILTERXML function i gives the result of keeping the first occurrence so the result was
{"English";"German";"Italian";"Belarusian";"Russian";"Bulgarian";"French"}
Can someone explain?
This XPath,
//b[not(preceding::*=.)]
selects all b elements that do not have a preceding element with the same string value.
One might use this XPath to select only the first such elements, eliminating later "duplicates."
Notes:
To limit the scope to preceding b elements, use //b[not(preceding::b=.)].
To limit the scope to preceding b sibling elements, use //b[not(preceding-sibling::b=.)]
It means "select all b nodes for which there doesn't exist a preceding node equal to the reference node". Therefore, keeping the first and rejecting the last is the correct behaviour.
I want get all values of dropdown and want to store them somewhere. from follwing NASDAQ site https://www.nasdaq.com/symbol/ge/historical i want get all values of Timeframe and want to somewhere so that i can use those values one b one in loop and get the values of stock for all timeframe. Click below image screenshot
It's not that easy to get each of the values, but it's not impossible. First you can get all the values in a Data Item as text. If you spy the element, you will notice that the attribute Value contains what you want. So you will need to use a read stage and get this specific attribute's value (you can ignore the PDF elements):
Doing so will give you the following:
The problem with this is that you cannot use this in a loop. One way around would be to split on space:
And the resulting collection (I called it Split Values) will look like this:
But it's not quite there yet. You should however be able to use this collection to get the collection you need (or use it directly).
If you use it directly, I would say it should look like this:
Empty? has the expression [Split Values.words]="" (notice the last row is blank)
Value is number has the expression IsNumber([Split Values.words])
Set Current Item as Number has expression [Split Values.words] with store value Current Item.
Append word to Current Item has expression [Current Item]&" "&[Split Values.words] with store value Current Item.
I have four items with tags
"AA","BB","CC" and "DD" respectively.
If I want to filter tags in
Get Next Item stage
such that items with
either tag "AA" or "BB"
get picked then what should be tag filter expression?
I tried
"+AA;+BB"
But it did not pick any item.
Please help.
In the documentation of that object you can find following information about using parameter "tag" when getting new items from the queue.
Optionally, a tag mask to filter by. This can consist of any number of
tag searches - each term can be separated by a semi-colon and they are
all applied to the search (ie. they are AND'ed terms not OR'ed terms).
For example, "Account: Joint; -Balance: Overdrawn; Card: *Visa*" will
include any items which match all the terms, ie. every item must have
an 'Account: Joint' tag applied, no item can have a 'Balance:
Overdrawn' tag applied, every item must have a tag applied which
starts with 'Card: ' and then contains the text 'Visa'.
The important part in that documentation, is that all the parameters are applied, and only the items that pass all the filters with be taken from queue. I think that what you're trying to achieve here is impossible to do in one "Get next item" action.
i would advise to do one of following:
Redesign the Tags in the process
Use Two step process of getting items from queue there. E.g. First try to find all AA's, and then all BB's.
I think you can try to filter by setting "-CC;-DD", so Blue Prism filter by searching for AA or BB but without CC and DD.
I have 100 documents with a multi-value field. The field holds 5 possible values (Albert,Ben,Chris,Don,Ed) let's say. The field must contain 1 value, but can contain up to 5.
I need to compute the number of docs that contain each value, so
Albert 56
Ben 22
Chris 79
etc.
This seemed easy. I constructed a view that contains the docs, the first column is the field, and I selected show multiple documents for multiple feeds.
In SSJS loop through my master list of values in the field, and for each one do a getDocumentByKey.
myArray = applicationScope.application;
var dc:NotesDocumentCollection;
for (index = 0; index < myArray.length; ++index) {
dc = view1.getAllDocumentsByKey(myArray[index]);
Print(dc.getCount())
}
This gets the first value correctly, but none after. If I just hard code a particular value, it works. But when I call the getAllDocumentsByKey a second time, it doesn't return the right value.
I think this would work fine in LS, but in SSJS I must clear or recycle or rest something, but I don't know what.
Bryan,
Two things to try in this order:
Your first line of myArray = applicationScope.application; doesn't look right. I suspect that you are not actually getting an array here. I think you are just getting the first value from your applicationScope. Add a print statement on the next line of print(myArray.length); If it is always equal to one, that is your problem. You are not using var and you should set the variable to some java type using a colon.
Before the end of your for loop, try setting your collection to null. dc = null; This way you know for sure that you are getting a new collection in the next iteration.
Are any of your multi-value field values ambiguous? getAllDocumentsByKey(Vector) does partial matches. Unless you ever want that, I would recommend always using the second parameter and setting it to true, same always for getAllEntriesByKey().
An alternative, which will definitely perform better, would be to add a total column to the view. There's a performance hit of that on the view indexing, but you can then use a ViewNavigator with getColumnValues() and getNextSibling(). getCount() is extremely poor performing in LS and will almost certainly be as poorly performing in SSJS/Java. See this blog post from a few years ago http://www.intec.co.uk/why-you-shouldnt-count-on-a-notesviewnavigator/
If I understand that right: you want to count all values that are possible over an amount of documents to have a 5 value list with corresponsing 5 value counts, right?
You could loop through all docs, loop through all values and add entries to a HashMap with the value as key and an int as value (which should be increased everytime). Afterall you have a Map with 5 values holding the sums of each keys.
You will never get the right answer with getAllDocumentsByKey(). When document shows in one category, it will be missing from the collection of next category. That's the way it works.
Use ViewNavigator instead. Build it by category and simply count ViewEntries.
I have this number extracting problem.
I want to get all matches that don't have a certain number in it
ex : 125501874, 125001873
Every number that as 55 at the position 2 are not to be considered.
The first numbers range is 0 to 9 and the second is 1-9 so the real range is [01-99]
(we cannot have 00 as the first two number)
With Lucene I wanted to add NOT field:[01-99]55*
But it doesn't seem to work. Is there an easy way to find ??55* and disregard it in a Search("NOT field:[01-99]55*")?
Thank you Lucene guru
Lucene can do this very efficiently if one creates an "index-only" field with only the third and fourth digits in it. The complete value can be "stored" (or stored and indexed if other queries use the whole number) in the original field.
Update: A followup comment asked, "Is [there] a way to create a temporary index on only the second digit?"
Using a ParallelReader "vertically partitions" the fields of an index. One partition could hold the current index, with its fields, while the other is a temporary index with the new field, possibly stored in a RAMDirectory.
Assuming the number is "stored" in the original index, iterate over each document in the original index, retrieve the stored field, parse out the key digits, and add a Document to the temporary index with the new field. As the ParallelReader documentation states, it is imperative that the document numbers match in both indexes.
Thank you erickson, Your solution is probably the best, using ParallelReader if only I could use temporary indexes, cause we cache the search query, we will need those later.
But like you said before, better start with an index on the relevant digits straighaway.
I have another solution.
NOT field:0?55*
NOT field:1?55*
...
NOT field:9?55*
It is efficient enough for the search I'm doing and it bypass the first character wildcard limitation. I wouldn't use that if their where more digits to check or if they where farther from the start.
Now I'm testing this on a million of row and it's pretty efficient for our needs.