Display Created Zones in Sphinx? - sphinx

I seem to be having trouble with one zone I created in my Sphinx Index.
I did create an entry in the index:
index_zones = title,all
If I do a ZONE SphinxQL search on title it works fine:
Select * from INDEX where MATCH('ZONESPAN:title Red')
I get results. However if I do
Select * from INDEX where MATCH('ZONESPAN:all Red')
I do not. Yet when I search on those same fields which I likewise indexed as fields they both work. Meaning:
Select * from INDEX where MATCH('#(all) Red')
Gets results. So there is matching data in the all field yet it fails when I try to search on it as a ZONE. I have established Zones work since the title ZONE works.
I tried using
DESCR INDEX
Yet that seems to show fields and strings not ZONES. How can I test if somehow the all ZONE is in fact indexed as a zone?

I dont think 'all' works as a zone (at least as some sort of 'everything' magic zone) - it would just be indexing content within <all> HTML tags :)
MATCH('ZONESPAN:all Red') is then matching text between <all>...</all> html tags :) - it does not match any text in the rest of the field, including the title zone

Related

How can I show InfluxDb tags only for todays date?

I am having trouble getting this query in InfluxDb to work properly. Wondering if someone can help.
I want to show tag values but only for the current days data. I have this
SHOW TAG VALUES FROM table WITH KEY = "name"
This list shows all values from the full measurement. I want to only show values for data that was inserted today.
I've tried
SHOW TAG VALUES FROM table WITH KEY = "name" where date='2018-10-23'
SHOW TAG VALUES FROM table WITH KEY = "name" where time='2018-10-23'
as well as some other variations but can't seem to get this right.
Does anyone know how to properly form this query?
I am using this as a variable inside Grafana.
Thanks
For select time you mast define time range, start and end.
This is working solution.
SHOW TAG VALUES FROM table WITH KEY = "name" where time>='2020-04-26T00:00:00Z' AND time<'2020-04-27T00:00:00Z'
Time condition is not supported in SHOW TAG VALUES query - there is an issue for that https://github.com/influxdata/influxdb/issues/5668. You can find a workaround with a continuous query in that issue comments.
how about use subquery? instead of "show tag values"
like this
# show tag values from with key = “TAGName” where condition
select TagName from (select field, TagName from Measurement where condition)
it return timestamp with tag values
Can't upvote answer https://stackoverflow.com/a/58404465/18224224 but this solution has worked for me.
select "tag_name" from (select "field_value", "tag_name" from "table" WHERE "tag_name_filter" = 'tag_value_filter' AND $timeFilter group by "tag_name" LIMIT 1)
$timefilter variable will automatically use dashboard time range selected if variable uses refresh : on time range change
Grafana Dashboard variables screenshot
Grafana Dashboard variables screenshot with different time range selected in dashboard

Query date range for date saved in a text field in IBM Notes and Domino

There is a date saved in a text field. I'm trying to get documents collection when the field is in a date range using db.FTSearch method. But > and < doesn't work in a text field. Are there any way to convert text field? I'm not familiar with IBM Domino and have tried #TextToTime but doesn't work.
A few ways:
use db.Search instead of db.FTSearch; the syntax is completely different though, plus it is rather slow, but if you have to execute your query once per day or even less, you're fine
write an agent that converts the text date fields into new real date fields, so you can do your FTSearch; make sure you adapt the form used to create the documents, so that it also creates those date fields
use a view, where the first 2 columns contain the date value of your text fields, and sort the view; you'd have to use getDocumentByKey (but I'm not sure this works)
Your date is stored as text, so you need to use #TextToTime().
I.e.,
FIELD #TextToTime(field1) >= [01/01/2018] AND
FIELD #TextToTime(field1) <= [01/19/2018]

User-defined date range for Access query pulling outside date range

I have an Access 2007 database that requires a query be run every week to gather every record that was worked on the prior week. The current setup is:
I have a query where the date range's WHERE criteria is: Between [Forms]![frm_Menu]![txt_fromdate] And [Forms]![frm_Menu]![txt_todate]+"1"
"fromdate" and "todate" text boxes in frm_Menu are unbound text boxes. "fromdate" has an AfterUpdate event that fills in "todate" with the date chosen in "fromdate" plus 6 days.
frm_Menu has a button for running the query after "fromdate" and "todate" are filled in.
The issue is, when I run the query for a week's worth of records, I get entries outside the selected date range. For example, if I have "3/1/2015" in the "fromdate" text box and "3/7/2015" in the "todate" text box, I'll receive the results from 3/1 to 3/7, but I'm also getting results from 3/10, 3/11, and 3/12.
At first, I thought it might be reading "3/1/2015" as "3/1x/2015," but that doesn't explain why I'm ONLY getting extra results from 3/10 through 3/12 and not 3/13 through 3/19 as well.
Does anyone know what might be causing this? To work around this problem, I've just been running a query that gathers EVERYTHING and then filtering out what's need in Excel before sending it over. Ideally, I'd like for the person who needs this report to be able to open the database themselves, pick the date range they need, and then export the query results from Access.
It turned out I had the data type for the Dates column as Text instead of Date/Time. Retried the same query after changing the column to Date/Time and it worked perfectly. Just a PEBKAC error.

Default range for date range filter in tableau

I want to set the default range on a date filter to show me the last 10 days - so basically looking at the lastDate (max date) in the data and default filtering only on the last 10 days (maxDate - 10)
How it looks now:
I still would want to the see the entire range bar on the dashboard and give the user the ability to modify the selected range if he wants to. The maxDate changes after every data refresh so it has to be some sort of a condition that is applied to the filter.
How I want it to look (by default after every refresh of data - new dates coming in):
Any suggestions on how this can be done? I know I can use the relative date and show the data for last 10 days but that would modify the filter and create a drop down which I don't want.
Any suggestions are welcome!
One simple approach that does most of what you want is the following:
Create an integer valued parameter with a range from 1 to some max
you choose, say 100. Call it say num_days.
Show the parameter control on your dashboard as a slider, and give
it a nice title like "Number of days to display"
Create a boolean calculated field called Within_Day_Range defined as:
datediff('minute', [My_Date_Field], now()) < [num_days] * 24 * 60
Put Within_Day_Range on the filter shelf and select the value true.
This lets the user easily select how many days in the past to include, and works to the granularity of minutes (i.e. the last two days really means the last 48 hours, not starting at midnight yesterday). Adjust the calculated field if you want different behavior.
The main drawback of this approach as described so far is that it doesn't display the earliest date possible in the database because that is filtered out. Quick filters do an initial query to get the bounds, which has a performance cost -- so using the approach described here can avoid that query and thus load faster.
If you really need that information on your dashboard, you could create a different worksheet to get just the min([My_Date_Field]) and display that near your parameter control.

Can't group by year from a date row

I have a field of date-time type. I added this field into a view and formatted the date-time field to show only year. When I switch 'aggregation' on in Views and try to group this field it didn't work as i expect and show all the dates again. I saw the Vies-query and there wasn't any preformatting. It was grouping by dis field only. I want the modify the query to get this fields formatted as I need (years only).
Yes, it seems the aggregation settings work on the query, vs on the results that are output that you've formatted differently.
Here's how you can do the aggregation though:
Select the 'Settings' next to the 'Table' format
Select your date field (that you only show the year on) under the 'Grouping field Nr. 1'
Then just exclude that field from the display, since it'll be output at the top in the group
And here's what the result will be like roughly (for table view... you can try a variety of different ones like lists, etc and style however you like with css). I'm only outputting the title field for mine
Anyway, hope this helps!