Own filter Solr - 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.

Related

Solr single query with AND and OR option

[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

How can I match subdomains in a solr search?

I can found domains using ClassicAnalyzer.
Given a doc with a domain like facebook.com, what is the best approach to match queries like
faceboook.com (obvious)
xyz.facebook.com
abc.xyz.facebook.com
facebook
Any combination of analyzers (tokenizers, filters...) or approches to build my own will be welcomed.
Thx!
I think in this case StandardTokenizer helps better. It Preserves Internet domain names and email addresses as a single token. it helps if you post an example document and few search terms that you would like to match.
Update: Look at text_general field type , that does exactly what you are looking for. I ran analysis for xyz.facebook.com,faceboook.com,abc.xyz.facebook.com and facebook and it kept each of them together and matched the way you wanted.
I ended using a PatternCaptureGroupFilter with a pattern like ([a-zA-Z\-_0-9]+)

Solr: how to custom score

I'm using solr 4.5.
I would like to customize solr score using in my "formula" the termFreq and PhraseFreq (it depend if in the query i have an term or a phrase).
Now I'm using in a url request the param:
sort=myFormula desc
it works but my problem is that in output i want also the output of my formula, now the solution is or to put the formula also into fl param or to customize the score :) and i'm looking for the last one solution.
Please, do you have any suggest or link/guide to give me to learn how is it possible customize the solr score? I'm searching on google but no results relevant.
Thanks in advance.
How about implementing your own CustomScoreQuery? The second example here as well as this blog post talk about how to do it.

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