How to facet.pivot with spring-data-solr - spring-data-solr

When declaring this method:
#Query(value = "*:*")
#Facet(pivotFields = {"type","status"}, limit = 10000)
FacetPage<SolrCrimeServer> findAllAndFacetOnTypeAndStatus(Pageable page);
I get
java.lang.IllegalStateException: 2 or more fields required for pivot
facets at org.springframework.util.Assert.state(Assert.java:385) at
org.springframework.data.solr.core.query.FacetOptions.addFacetOnPivot(FacetOptions.java:150)
at
org.springframework.data.solr.repository.query.AbstractSolrQuery.extractFacetOptions(AbstractSolrQuery.java:246)
at
org.springframework.data.solr.repository.query.AbstractSolrQuery.execute(AbstractSolrQuery.java:120)
With version
1.1.1.RELEASE
Thanks.

The pivotFields attribute of #Facet takes at least a tuple of field names within one argument.
#Facet(pivotFields={"type,status"}, limit=10000)
You can have a look at SolrQueryMethodTests. Additionally you may vote for this issue.

Related

karate xpath - Can we replace/delete a node

I'm looking to test error messages by modifying a valid xml message file.
I can easily add nodes like this in the scenario:
* def invalidDocumentId = read('Valid.xml')
* set invalidDocumentId /soapenv:Envelope/soapenv:Body = <tis:extraBonus>Extra</tis:extraBonus>
Given request invalidDocumentId
But I'd like to also remove nodes, update node names, change attribute names.
Is there a way to set that or do I need to call Java com.intuit.karate.XmlUtils.
First, removing and adding a node and even attributes should be easy, just use the remove and set keywords with XPath. They will over-write values if needed.
* def base = <query><name>foo</name></query>
* remove base /query/name
* match base == <query/>
* set base /query/foo = 'bar'
* set base /query/#baz = 'ban'
* match base == <query baz="ban"><foo>bar</foo></query>
And the good news is that if you have some really tricky XML manipulation requirements, the string replace syntax comes to the rescue. This is best explained in this other answer on Stack Overflow: https://stackoverflow.com/a/50367134/143475 | https://stackoverflow.com/a/53682733/143475

SRSS Report Builder SUM IIF from different datasets

I have two datasets in Report Builder 3.0 with a similar field and I want to put a SUM of the number occurrences of a particular value in that common field across both datasets.
I've got an expression I'm using for each individual dataset:
=SUM(IIF(Fields!caseorigin.Value = "mail",1,0))
and
=SUM(IIF(Fields!cliorigin.Value = "mail",1,0))
But I can't seem to work out a way to sum the values from both datasets. I've tried:
=SUM(IIF((Fields!caseorigin.Value, "caseDS") = "mail",1,0)) + SUM(IIF((Fields!cliorigin.Value, "cliDS") = "mail",1,0))
Is there any way to make this work, or an alternative method?
Just looks like a syntax error here; when specifying a scope it should like something like:
=Sum(Expression, Scope)
Applying this to your example:
=SUM(IIF(Fields!caseorigin.Value = "mail",1,0), "caseDS")
+ SUM(IIF(Fields!cliorigin.Value = "mail",1,0), "cliDS")
Should work for you.

Neo4j python binding: Querying node index for a set of values

I have a Neo4j database graphDb where nodes have a property 'label'. I have a Lucene index 'my_nodes' with key 'label' which indexes the values of node property 'label'. Now I want to retrieve nodes which have property 'label' equal to a value from a list of possible values labellist. To accomplish this, I wrote a Cypher query the following way:
cypherQ = """START n=node:my_nodes('"""
+' OR '.join(['label:'+str(i) for i in labellist]) + """')
RETURN n"""
result = graphDb.query(cypherQ)
That works fine, but I wonder whether there is a way to write a parameterized query anyhow?
I tried something like:
cypherQ = """START n=node:my_nodes('label:{params}')
RETURN n"""
result = graphDb.query(cypherQ, params = labellist)
But this surely does not work, though if there is one value in labellist it works. And the neo4j tutorial does not provide much material on this issue.
Once again I am using a python binding for Neo4j.
The parameter is working for the whole query part of the index, so this would be
cypherQ = """START n=node:my_nodes({queryParam})
RETURN n"""
and you construct the query in your client code and pass it into Cypher as one parameter.

List Members based on extended profile fields in buddypress

I'm working on getting a list of members based on the fields they selected on the extended profiles fields in buddypress. Here is my code:
<?php
$membership_group = "Orange Membership";
$db_query = "SELECT user_id FROM wp_bp_xprofile_data WHERE field_id = 33 AND value = \"" .$membership_group ."\"";
$match_ids = $wpdb->get_var($db_query);
$get_these_members = 'include=' .$match_ids;
if (bp_has_members($get_these_members, 'per_page optional=9')) {
//Some Codes here
}
?>
The result is returning just the first member it gets from the query instead of a list of members. Please say what I'm doing wrong.
Thanks
I think you should dive into the class BP_Core_User and its method get_users. It supports meta_key and meta_value.
You can also try to make just a search by field value. So pass an argument s to bp_has_members.
And per_page optional=9 is a wrong syntax.
This:
$wpdb->get_var($db_query);
returns a single var !
This is what you want:
$wpdb->get_col($db_query);
Then fix the syntax error mentioned by slaFFik

Rally custom grid with ((Parent = null) or (Parent.Name = 'xxxx'))

Can you create a custom User Story grid in Rally with the following query?
(((Parent = null) AND (Owner.Name = "dummy.name#email.com")) OR ((Parent.Name contains "Example") AND (Owner.Name = "dummy.name#email.com")))
Every time I try to do this it only returns results for the second part of the query. It seems like it cannot combine the Parent = null and the Parent.Name contains "Example".
Thanks for any feedback! I know that we could create two grids, but it would be nice to combine it into one.
This looks like a bug to me. Ignoring the owner portion of the query and taking just the Parent portions, per the title of your question: ((Parent = null) or (Parent.Name = 'xxxx')), it seems that I am also always seeing results that match the latter condition. If I switch the order, I get Parent-less stories. I'd recommend submitting a Case to Rally Support - rallysupport#rallydev.com - they can get this filed with the Rally developers.