Solr single query with AND and OR option - solr

[Sorry if it is a duplicate Question]
I wanted to extract results from solr which obeys multiple conditions on the same field, with both AND and OR operations in it. Is it possible to do something like this
q=_word:* AND _link:0 OR !_link:*
If I query this I am not getting any response.
Can anyone help me to achieve what I want? If possible share a link, I searched for it but I am not able to find how to solve this.

(_word:* AND !_link:*) OR (_word:* AND _link:0)
This works

Related

SOLR query specifying several values

I am doing a solar query. With my filter I want to look for various values of x (1004, 1005, 1006). I tried using x:100[456] but it did not like that. I did a search in google and found some information but not how to do this. I remember seeing someone else do something similar a few weeks ago but I cannot remember what it was. What would be the correct syntax? I suppose I could figure out how to do an OR if the number of them was small enough.
If you are looking for a range query, the solr syntax is:
x:[1004 TO 1006]

Is it posible to spellcheck and search in the same Solr request?

Is it possible to do a spellcheck and a search (using topmost collated suggestion from the list) within a single Solr request?
I see that if my query is spelled correctly, I get search results returned. But if the query is misspelled, I get suggestions and collations only.
Any pointers will be very helpful.
You need to use 1) spellcheck.collate=true 2) behind the scenes analyze the collation and re-execute the query .
Documentation here: http://wiki.apache.org/solr/SpellCheckComponent#spellcheck.collate

Own filter Solr

have long since I have been researching, but so far have not found anything to solve my problem. I'm trying to create a filter for Solr, which add a TOKEN. For example, the entry is "Football" and the output is "Football" and "Brazil." If possible I would like a practical example. Thanks in advance.
Instead of a filter you can use SynonymFilterFactory to add Synonyms as mentioned in your example.
This will allow you map terms and related terms, which would get added to the index.

How to configure Solr for name searches

I'm trying to create a searchable list of names (1M names+) and need some loose matching for the names. I've tried a few ways of configuring the server/querying the instance, but either ONLY exact matches are returned, or I get huge, inappropriate result sets missing the exact matches.
I'm new to Solr, is there a good example of doing this, or at least a good starting point I can work from to achieve what I need?
Many thanks in advance
Have a look at fuzzy searches. They provide Levenstein distance which is what you refer as "loose matching".
If you want to search similar sounding names you can also check PhoneticFilterFactory

field listing in solr with "fl" parameter for a field having space in between

I have a field in my solr schema as "Post Date"(exclude the quotes). when i fire a query with "fl" (field list) parameter in order to view only Post Date of search results, since this field contains a space I am not getting anything in the docs responses. I tried using +, %20 but still i get no results. Please help.
I would like to inform that i have found a solution to this. I tried experimenting and hence came up with a solution on putting \+ as the substitute for white space in the query. Hence the query should be Post\+Date:[ranges]
I couldnt aford to change my schema as many teams are depending on it and we are upgrading our system to a new search engine.
You can specify (what Solr deems crazy) fields by wrapping them like this:
field(Post Date)
This actually changes the returned results fieldname too so you'll get back something like:
"field(Post Date)" : "2010-01-01"
And not just the name as you might imagine.
As a possible workaround, you might be able to use a wild card to achieve your results. Using the solr wiki http://wiki.apache.org/solr/CommonQueryParameters#glob you may be able to specify fl=Post*Date which would possibly get around your problem. I have not verified this but it might work.
Update: This doesn't seem to work on either version of solr I tried (1.4.0 and 3.6.1). Looks like this may have been discussed at http://wiki.apache.org/solr/FieldAliasesAndGlobsInParams but it does not appear to be implemented.

Resources