SOLR df and qf explanation - search

I cannot find an adequeate explanation of how these query params interact
I am getting suprising (to me) results that if I specify
qf=title^20 description^10
then I get no results
however if I then add
df=description
I do get results
df is set to text in solrconfig.xml - which will change - but my question is this - does the df setting somehow override the qf setting? this seems odd

df is the default field and will only take effect if the qf is not defined.
I guess you are not using dismax parser and using the default settings in solrconfig.xml
qf then won't take effect anyways and the df field which is text would not return values.
df=description searches on the field and hence returns values.
Try passing defType=edismax as parameter.

The df stands for default field, while the qf stands for query fields.
The field defined by the df parameter is used when no fields are mentioned in the query. For example if you are running a query like q=solr and you have df=title the query itself will actually be title:solr. The df parameter is supported by the default Solr request handler.
The qf parameter is something used by the dismax query parser and the edismax query parser. You probably don't have the defType=dismax or defType=edismax added to your request handler parameters or to your query. Try adding it and you should get the search results.

Related

Cassandra using 'like' in query condition

When I query from Cassandra with a CQL statement of:
select * from abctpl where tpl like '1-1'
In the table, the content of tpl which I want is '1-1-1', and it's unique.
But actually I get 3 rows. The other two tpls do not contain a string '1-1-1', I guess Cassandra regard '-' as a wildcard character. If tpl's word like '11111111' also can be selected.
So how can I edit the CQL to make it query the exact data?
select * from abctpl where tpl like '1-1';
I think the problem here, is that you're not providing the LIKE wildcard character %. If your SASI index is defaulted to PREFIX mode, then this should work:
select * from abctpl where tpl like '1-1%';
Take a look through the DataStax docs on using SASI indexes: https://docs.datastax.com/en/dse/6.7/cql/cql/cql_using/useSASIIndex.html . That has some query examples, along with how to specify the mode at index creation.
make it query the exact data?
And if it's exact data that you're after, using equals (=) does a better job of that than LIKE does.

Why aren't the values inserted into the mysql2 query?

Can you tell me, please?
Why does the mysql2 value substitution not work inside the IN operator?
I do this, but nothing works.
Only the first character of the array is being substituted (number 6)
"select * from products_categories WHERE category_id IN (?)", [6,3]);
You can do it like this, of course:
IN(?,?,?,?,?,?,?,?,?,?) [6,3,1,1,1,1,1,1,1,1,1]
But that's not right, I thought that the IN should be automatically substituted from an array =(
I haven't used this, but my gut feeling tells that array items map to question marks based on indexes, so in your case 6 binds to first ? and 3 looks for another one, but doesn't find.
If I were you, I'd try to make sure that my first array item is then actually array, so I'd rewrite it:
"select * from products_categories WHERE category_id IN (?)", [[6,3]]);
I suspect you are using this with .execute(), which is short for prepared statements "prepare first if never executed before"+execute. While api is very similar to .query() one biggest difference is that in case of prepared statement only parameters are sent at execution time, unlike .query() where whole query text is interpolated with all parameters on the client. As a result, you need to send exactly the number of parameters as you have number of placeholders in original query text ( in you example - one ?). The whole [6,3,1,1,1,1,1,1,1,1,1] is treated as one parameter and sent to server as "6,3,1,1,1,1,1,1,1,1,1" string ( because during prepare step that parameter was likely reported by server as VAR_CHAR )
The solution is 1) use .query() and interpolate on the client or 2) build enough ?s dynamically and prepare different PS for different number of IN parameters

Lucene syntax: what is the difference between AND and +

I am newest in Lucene.
I'm using Lucene.NET version 2.9.4.
What is the difference between these queries?
the first is:
title:hello AND tags:word
the second is:
+title:hello +tags:word
I testing a software, and I note that the first returns 3 records, and the second returns many records.
I observe that the first returns records where title and tags fields are fuel, but the second returns records where title and tags can be empty.
Is it the difference?
There is no difference between the two. clause1 AND clause2 is effectively shorthand for +clause1 +clause2
Similarly: clause1 clause2 = clause1 OR clause2
Note, there is really no equivalent for +clause1 clause2 using the boolean operators.
Are you sending the query over the Internet, if you are and not urlencoding the request correctly it could be misinterting the '+' as an encoded space and therefore lucene just runs the second query as if the +'s not there which would just OR the two parts and give the results you get.
title:hello tags:word

Neo4j - index lookup issue

I was trying to set index type from exact to fulltext in neo4j shell, so i can do incasesensitive search with lucene query. So i used this command:
index --set-config Destination type fulltext
but it didn't work. Still couldn't do case insensitive search, so a played around and change some other values, like _blueprints:type and to_lower_case.
That didn't do any good.
Now it somehow ignores first character of name value ( weird ! ) . So if i am searching for "London" for example and i type "Lon" it returns nothing. But if i type "ond" it returns the node. The same for every node.
I tried setting everything back to normal. Didn`t help.
What did i mess up? What am i missing?
I am using a Everyman PHP library to communicate with database.
I created new index with "to_lower_case" property.
I think that will solve my problem, just have to convert string to lower case before inserting it into query. It seems to work.
Setting configuration afterwards doesn't update already indexed values (as the shell notes, I think). If you've created your index with "to_lower_case=true" then additions as well as queries will have the values converted to lower case. Calling Index#get will still require you to lower-case it yourself.

How to read cassandra data with out case sensitive

I need to get the data from cassandra with out case sensitive. Please help me.
There is no case-sensitivity concept in Cassandra. All the data is stored as byte[], so it's not even a String.
You can make a custom comparator (see the API) which transforms byte[] to String and disregards case.
The other thing to do is just get the data and transform it on the client side.
Actually, your question is quite unclear as of what is your goal, so I can't give more details.
Update: Run a one-time job that fetches all records from the db and updates them, setting to lower-case. Then continue inserting everything with lowercase.
This has been resolved if you have SOLR enabled using:
CREATE SEARCH INDEX ON tableName WITH COLUMNS *, camelCaseColumn { lowerCase : true };
An index is created that allows the select statement to use lowercase in the where clause. For more details search for LowerCaseStrField.

Resources