Solr empty query can't find the data - solr

I am searching for a long time on net. But no use. Please help or try to give some ideas how to achieve this.
I tried to query the data of status==1 and projectMaintainUserIds!=null and leadsStatus!=null through the following statement, but the result is different from the expectation, and the returned result set is empty.
q=(status:1)&fq=(-projectMaintainUserIds:*) AND (-leadsStatus:12)
If I modify the query statement slightly, it seems to return the correct result:
q=(status:1)&fq=-projectMaintainUserIds:* AND -leadsStatus:12
I don't know why parentheses affect the results of '-filed:*' queries.

Related

Apache Tinkerpop Gremlin Returns Query Results using Select Values As

I have this query that it is working as expected for me.
g.V().or(hasLabel("poi"),hasLabel("business")).as("dest")
.outE().inV().hasLabel("region").as("reg")
.select("dest").values("name").as("dest_name")
.select("dest").values("budget").as("dest_budget")
.select("reg").values("name").as("reg_name")
.select("reg_name","dest_name","dest_budget")
This query yields this result.
As I have expected. However I need to retrieve more properties from the "destination" I need to retrieve more 10 properties. This will me into something like this
g.V().or(hasLabel("poi"),hasLabel("business")).as("dest")
.outE().inV().hasLabel("region").as("reg")
.select("dest").values("name").as("dest_name")
.select("dest").values("budget").as("dest_budget")
.select("dest").values("property3").as("property3")
.select("dest").values("property4").as("property4")
//insert more queries like from the above
.select("reg").values("name").as("reg_name")
.select("reg_name","dest_name","dest_budget","property3","property4")
The query will grow long eventually which I am trying to avoid since I need to select values as well from the region as well. So My initial thought was to use select to select multiple values and label them each with an alias like this
g.V().
or(hasLabel("poi"),hasLabel("business"))
.as("destination")
.outE().inV().as("region")
.select("destination").values("name","budget").as("dest_name","dest_budget")
.select("region").values("name").as("reg_name")
.select("dest_name","reg_name","dest_budget")
However I was surprised with this result. Which I was not expecting.
To my understanding the names in values will be mapped to each values passed in the as step. Am I wrong?
Is there anyway for me to retrieve the result from the first screenshot without writing a long query?
The as() labels the step, not the values within that step. So by doing:
.select("destination").values("name","budget").as("dest_name","dest_budget")
you're just naming the values() step twice. I think that you can drastically simplify this traversal for what you want to get as the result though and it doesn't involve stringing together a lot of select() steps:
g.V().or(hasLabel("poi"),hasLabel("business")).
project('dest_name','dest_budget','reg_name').
by('name').
by('budget').
by(out().hasLabel("region").values('name').fold())
You will get a slightly different structure in that "reg_name" will be a list of all the region names rather than having a flattened structure, but you could unroll that I imagine if needed.

a function calculate has been used in a true/false expression that is used as a table filter expression which is not allowed

I have a to check the current month and current year value for a measure in ssas tabular model but due to type mismatch i am not able to do this. For this, i have created a measure in which i am using this dax query
:CurrMonthYear:=CONCATENATE(CONCATENATE("""",concatenate(year(now()),CONCATENATE(0,month(now())))),"""") output: "201704"
...to calculate currentyear and currentmonth. But when i give this value in a measure like this:
SumOfRevisedForecast:=CALCULATE(SUM(DimRevisedForecast[RevisedForecast]),DimRevisedForecast[Approved] <>"N" && DimRevisedForecast[Approved] <>blank(),'DimRevisedForecast'[CalendarYearMonth] =CurrMonthYear)
...this doesnt work. Though, giving "201704" in place of CurrMonthYear works.
Can anybody help me in this?
Thanks in advance
The problem is not with CurrMonthYear measure, it's with your second formula - CALCULATE function does not accept measures as criteria, only values. That's why it works when you put "201704" explicitly but fails when you use the measure.
A common solution is to wrap the criteria into FILTER function, something like:
CALCULATE(SUM(DimRevisedForecast[RevisedForecast]),
FILTER ('DimRevisedForecast',
'DimRevisedForecast'[CalendarYearMonth] = [CurrMonthYear])
A great explanation of this issue is here:
FILTER() – When, Why, & How to Use It

How to set NOT clause on Date range query in Solr

Have been trying to understand this for a while ...
How can I specify NOT clause in the following query?
{!field f=schedule op=Intersects}[2016-08-26T12:30:00Z TO 2016-08-26T18:30:00Z]
{!field f=schedule op=Contains}[2016-08-26T12:30:00Z TO 2016-08-26T18:30:00Z]
Like, without LocalParams, we can specify -DateField:[2016-08-26T12:30:00Z TO 2016-08-26T18:30:00Z] to get an equivalent NOT clause. But, I need a NOT Contains Date Range query.
I have tried a few options but I end up getting parsing errors. Surely there must be some obvious way I am missing.

NOT condition not working in solr

I am no Korean expert and am finding it difficult to fix this, searching for the following query, but the NOT condition doesn't seem to be working.
(stnostem:((옵티머스 OR "엘지 스마트폰") AND NOT ("옵티머스 프라임" OR 프라임)))
the search result return result with the NOT condition keywords? How can this be fixed.
Regards,
Ayush
You might try using the - to specify a pure negative query. Try the following:
stnostem:(옵티머스 OR "엘지 스마트폰") -stnostem:("옵티머스 프라임" OR 프라임)
You may need the AND between the two queries depending upon what your DefaultQueryOperator is.

Error with MultiValue parameter

I made a couple of reports that are using a data-source for the parameter values. The same query is specified in available values and default values, so that I can select multiple values at once. The query usage is like this:
WHERE (Column.Name IN (#Parameter))
However, I get this error:
Any ideas what could it be? Other reports using same method work fine, but with this one it doesn't.
So i Ran the SQL Profiler and seen that the errors came from the code that is looking is the param a null (#param is null) that was the mistake because i allready sead in the options to now allow null
Thank you Chris Latta you helped me allot :)

Resources