MySQL equivalent in solr - solr

How to convert the part of mysql query into solr query,
IF(condition, valueOnConditionTrue, valueOnConditionFalse) as result;

Related

How to select multiple TYPEs using Solr in Alfresco?

I have a following CMIS query and need to perform it in Solr query language
SELECT * FROM ecmcnddoc:common_attr_aspect WHERE (cmis:objectTypeId='D:ecmcndintregst:nd_int_reg_standards' OR cmis:objectTypeId='D:ecmcndcountryst:nd_country_standards')
The problem is how to get two TYPES together in Solr?
In case of single type it should be
search +TYPE:"ecmcndintregst:nd_int_reg_standards"
but how to get them both ecmcndintregst:nd_int_reg_standards and ecmcndcountryst:nd_country_standards ?

Synonyms in Solr Query Results

Whenever I query a string in solr, i want to get the synonyms of field value if there exists any as a part of query result, is it possible to do that in solr
There is no direct way to fetch the synonyms used in the search results. You can get close by looking at how Solr parsed your query via the debugQuery=true parameter and looking at the parsedQuery value in the response but it would not be straightforward. For example, if you search for "tv" on a text field that uses synonyms you will get something like this:
$ curl "localhost:8983/solr/your-core/select?q=tv&debugQuery=true"
{
...
"parsedquery":"SynonymQuery(Synonym(_text_:television _text_:televisions _text_:tv _text_:tvs))",
...
Another approach would be to load in your application the synonyms.txt file that Solr uses and do the mapping yourself. Again, not straightforward,

Not use wildcard when query solr string field value

My question is I found when I use wildcard in solr query, it will be very slow. So I don't want to use the wildcard(*) query, for example, I want to search the mail address (gosling.abc#gmail.com), if I input 'abc' keywords, my q parameter maybe like q:abc
How should I do with this condition?
I am newbie in solr, can anyone help me?
(Currently, I have 10,937,547 document in my solr cloud. My solr version is 4.1)

DSE search - Solr multi valued field schema can't be mapped with CAS schema :(

I start my DSE node as Solr node i.e. /dse cassandra -s
I then create KS and CF. My CF has KEY field only.
I then publish Solr schema and solr config on it. My Solr schema has dynamic field which is indexed and multivalued.
I then try to insert data into CAS on cql command prompt, something like below:-
insert into device (KEY, deviceid, qualifier0) VALUES (000000000000, '000000000000', ['v0', 'v1']);
it throw error, says - Invalid character '['.
Questions -
Are multivalue fields supported in DSE?
If yes then how can I use them?
Thanks.
If you are going to used advanced Solr features, you really should be inserting the data using the Solr HTTP API, not CQL. But, I think you can insert into the multi valued field like so:
insert into device (KEY, deviceid, qualifier0) VALUES (000000000000, '000000000000', 'solrjson:[\'v0\',\'v1\']');

Does SolrJ have an equivalent of Lucene BooleanQuery?

I'm implementing an SQL-like query parser which outputs Solr query.
I know Solr/Lucene query is not entirely same as boolean query, like there are MUST/MUST NOT/SHOULD.
But I have to parse SQL-like boolean query automatically because the interface of our customers is already adopts SQL-like one.
Simple parsing like "A and B" -> "A and B" is OK, but such as "NOT(A and (B or C)) AND D", I'm at a loss when SolrServer returns a value which I didn't intend.
I read the following
http://lucene.472066.n3.nabble.com/Unexpected-boolean-query-behavior-td487306.html
but it seems to be of Lucene and I couldn't make out how to connect lucene BooleanQuery to Solr.
Does anyone have good idea?
If you look at the Lucene Query Syntax documentation, you should be able to determine how Boolean query syntax maps to native Lucene (and Solr) query syntax. Looking at the Lucene source would also be instructive (I know the Lucene.NET sources are pretty readable from my work on Lucene Does Not Create Parse Trees).

Resources