get all results with Dismax, like q=*:*? - lucene

Is not possible to do this like q=*:* with DisMax ?

first thanks for you answers.
Actually i found the solution that fit my need and it's :
< str name="q.alt">*:*< /str>
now i can list all the results .
;)

It is not possible to get all results with dismax using the *:* query.
To get the count of documents with this query, you have to use the standard query handler. You can switch to it by adding qt=standard in your query. Note that 'standard' is the default name, so check in your solrconfig.xml if it is the name you are really using.

Related

grafana multi value query in timestream

i have some problems displaying my aws timestream data in grafana. I added as a global dashboard variable DevEUI with 3 different specific values. But when i am using the multivalue syntax ${DevEUI} in my query with more then one value i get everytime a error.
hope somebody can give me a hint.
Regards and thanks in advance
You are most probably having a list of values as the value of your multivalue Grafana variable, but you are still using the = operator in your query. Try ... and DevEUI IN ('${DevEUI}'). Or maybe without the single quotes or the parantheses... the exact syntax depends on your Grafana variable.
But, this is just an educated guess, since I cannot see neither your database schema nor the definition of this Grafana variable (both of which are important details in a question like yours, for future reference).
This is how I did it for a multivalued string value:
timestream_variable_name = ANY(VALUES ${grafana_variable_name:singlequote})
You might have to adjust the formatting Grafana applies to the concatenated variable value it generates, depending on your data type.
I know this is long after the original question but #alparius pointed me in the right direction so I wanted to update the fix for the problem Joe reported.
Use formatting to get the proper quotes/values when formatting your query. Something like this:
Select * from database where searchiterm IN (${Multi-Value_Variable:sqlstring})

Lucene Query Syntax of field with a space

I am trying to perform two Lucene queries. The first one works. The second does not. My first query looks like this:
level:"dangerous"
My second query looks like this:
IP address:"11.22.333.444"
I'm not getting a query error. However, I know there are documents with the matching IP address. For that reason, I suspect the space between "IP" and "address" is causing the problem. However, I'm not an expert in Lucene. So, I'm not sure if I'm correct in that.
When I look at my result set using PostMan, I can see a document with a field that looks like this:
"IP address": "11.22.333.444"
Can someone please tell me if my query is correct? Or, if I'm missing something?
Thank you!
Yes, that space is the problem.
The space in a field name is allowable, but conflicts with query parser syntax. You are essentially running two subqueries combined as SHOULD clauses (ie, an OR):
IP
address:"11.22.333.444"
You can escape the space using a single slash before the space, like:
IP\ address:"11.22.333.444"

lucene join query

Is there a way to issue join queries (http://www.searchworkings.org/blog/-/blogs/query-time-joining-in-lucene) in lucene without directly using Query API? Is it possible to issue query in text form for this requirement? For example:
title:derivatives join(comments:great)
Apache Solr (4.0, not released yet) has a query parser which can handle join queries.
If I understand your question, I think you want a query like 'title:derivatives AND comments:great'. Or you can use code like 'queryParser.setDefaultOperator(QueryParser.Operator.AND)' to change the default conjunction operator to AND instead of OR ('OR' is used by default unless you tell Lucene otherwise).

searching in solr for specific values with dismax

I'm using the dismax handler to perform solr search over records (boosting some fields).
In my index, I have a RetailerId for each document, as well as other fields.
My query needs to search for documents that have this RetailerId as well as keywords:
http://localhost:8983/solr/select?qt=dismax&q=RetailerId:(27 OR 92) AND socks
What is the syntax for such a query?
Thanks!
Dismax does not support boolean operators. For a query like the one you described, you need to use the Standard Query Handler.
UPDATE
I have made a couple of tests and the fq parameter seems to work with dismax:
/select?qt=dismax&q=socks&fq=RetailerId:(27 OR 92)
if you want to filter by facet, user eDismax (extended disMax) that way you can say for instance q= your query AND face_name:"facet value"

Performing an ASP.NET database search with StartsWith keyword

I have a query. I am developing a site that has a search engine. The search engine is the main function. It is a business directory site.
A present I have basic search sql that searches the database using the "LIKE" keyword.
My client has asked me to change the search function so instead of using the "Like" keyword they are after something along the lines of the "Startswith" keyword.
To clarify this need here is an example.
If somebody types "plu" for plumbers in the textbox it currently returns, e.g.,
CENTRE STATE PLUMBING & ROOFING
PLUMBING UNLIMITED
The client only wants to return the "PLUMBING UNLIMITED" because it startswith "plu", and doesn't "contain" "plu"
I know this is a weird and maybe silly request, however does anyone have any example SQL code to point me in the right direction on how to achieve this goal.
Any help would be greatly appreciated, thanks...
how about this:
SELECT * FROM MyTable WHERE MyColumn LIKE 'PLU%'
please note that the % sign is only on the right side of the string
example in MS SQL
Instead of:
select * from professions where name like '%plu%'
, use a where clause without the leading %:
select * from professions where name like 'plu%'
LIKE won't give you the performance you need for a really effective search. Looking into something like Lucence or your engine's Full Text Search equivalent.