I would like to have an option to turn stemming on and off in my searches using some toggling options. How can I do that ?
Thanks,
N
One good option would be to store the value in two fields: one that uses a stemming analyzer and one that does not. You can use the <copyField> element to accomplish this. Your application could then choose which field to use during search.
Related
I am using CollapseQueryParser Plugin in Solr to collapse results across one common field.
Quoting the official Solr Documentation -
This parser collapses the result set to a single document per group before it forwards the result set to the rest of the search components. So all downstream components (faceting, highlighting, etc.) will work with the collapsed result set.
There are multiple facet fields in the query, and for one particular facet, I need to do the faceting or aggregation before the collapse happens and as usual for others. I tried excluding it with a tag and using collapse.facet=facet.before, but these didn't work.
Is there any way to do this in Solr? I am using Solr-7.7.2.
Thanks in advance!
As mentioned in the comments, I found a way to handle this. Posting this for someone who might encounter this in future.
I had to tag the collapse query seperately and then use that tag wherever i needed exclusion as shown below.
While collpsing -
fq={!tag%3DcollapseTag}{!collapse+field%3Dcollapse_field+nullPolicy%3Dignore+cache%3Dfalse}
And while faceting -
facet.field={!ex%3Dfksize,collapseTag}size_string_mv
I've been searching the documentation trying to understand if I can filter on page subclass fields the same way I can search on them.
From my experiments search filters must contain only the fields that are defined on the filtered type.
Is this the case? If so, is there any plans on implementing such a thing?
Is it possible to configure a Solr field to have multiple/split Filter chains? For example, could I create a Filter chain that looks like this?:
StandardTokenizer
↓
LowerCaseFilter
↙ ↘
SynonymnFilter PhoneticFilter
↓
NGramFilter
I've done quite a bit of searching and haven't found any examples of setting up a Filter chain this way.
EDIT
The main reason I would like to do this in the context of a single field (as opposed to indexing the data twice using a copy field) is for highlighting. If I use a copy field to run a different filter chain on the same data, my highlighting results come back like this:
"highlighting":{
"1234": {
"firstName_phonetic":["<hl>John</hl>"],
"firstName_ngram":["<hl>John</hl>"]
}
}
This makes consuming the results a bit more difficult as the consuming app needs to choose which highlighted field to display. Ideally, I'd get something back like this:
"highlighting":{
"1234": {
"firstName":["<hl>John</hl>"]
}
}
The output of one filter goes to the next filter in the chain. There is no support for "branching".
You'll be implementing this method if you want a custom filter.
org.apache.lucene.analysis.TokenStream.incrementToken()
This method returns a boolean. You can see an example here.
Another possible solution is to use a copyField to combine firstName_phonetic and firstName_ngram into firstName and use hl.fl=firstName
It sounds reasonable just to use copyField and index two different fields, each with its own chain.
But, I guess nothing prevents you from implementing your own MyCustomFilter that does what you need, and you plug that one into your conf.
How do I get only a row which matches my query: ?q=taxonomy_ids:1/636/*
Got that result:
Want only: <str>1/636/587</str>
There is no easy way. However, there is a trick, where you use a match highlighter and use those results instead of the results returned from the search itself. You may want to configure PRE/POST highlight tags to empty strings. There was an article on the web about somewhere, but I can't find it again.
The disadvantage is that you get your results twice. Once as docs and once as highlight.
The other option is a custom component that hooks into Lucene's explain structure.
I am looking for getting auto complete suggestions using Solr based on keyword as well as geolocation. Is there a way the 'Suggester' component or any other way, Solr can take in multiple fields for auto completion?
For e.g. if I have a restaurants database and I want to get suggestions using keyword e.g. 'Piz', the results should be based both on the keyword 'Piz' and also the locations that are close to certain latitude, longitude.
Is there a way to do it in Solr ?
Thanks.
you create a handler that:
in the index analyzer chaing, use EdgeNGram to math what the user entered so far
boost results with geodist(): play around with recip() etc until you get desired weight on the location boosting
call that handler and pass current location and user entered chars and you are done