In our compass mapping, we're boosting "better" documents to push them up in the list of search results. Something like this:
<boost name="boostFactor" default="1.0"/>
<property name="name"><meta-data>name</meta-data></property>
While this works fine for fulltext search, it does not when doing a field search, e.g. the boost is ignored when searching something like
name:Peter
Is there any way to enable boosting for field searches?
Thanks for your help and sorry if this is a dumb question - I am new to Lucene/Compass.
Best regards,
Peter
I am sorry, please ignore this question. The reason was completely different, the search result got blurred by a bad query :(
Related
I was comparing both ElasticSearch and Apache Solr for a search solution. Data that will go into the system is not moderated and I don't want anyone to search for something and some sexually explicit content to flash on the very top of the search result. But I don't want to remove them for search results either. I want to demote them, so that they come later in the search results. Can I do this in Solr or ElasticSearch ? Some pointers towards how to achieve this will be helpful.
In Solr you can't give "negative boosts" per se but you can boost everything that doesn't have the term. This can be done with the boost query:
...&bq=(*:* -erotic)^999
or in solrconfig.xml:
<str name="bq">(*:* -erotic)^999</str>
Where "erotic" is the term to which you wish to give a "negative boost". To add another term, add another bq=....
I'm developing a Lucene search for my Zend 1.12 site. I would like to combine fuzzy search and field boosting. I try syntax like
title:"query"^10~0.8 OR description:"query"~0.8
It seems not to change results. I've also tried to find hints on the Internet, nobody had similar problem. This is query for particular setting and field boosting cannot be set in advance.
The question is: does Lucene support such a combination of modifiers? Is this syntax correct?
how can I get spelling suggestion in shaerpoint search ,
I use
query.EnableSpellcheck = SpellcheckMode.Suggest;
then get the value of property
SpellingSuggestion
of the ResultTableCollection
but I'm not getting any spelling correction if I entered incorrect search keyword
any ideas please ???
I may be a little late to answer, were you able to find the solution?
The answer of your question depends if you want to get suggestions or you want spelling auto-correction.
When you use the following:
query.EnableSpellcheck = SpellcheckMode.Suggest;
FAST will try to find the correct terms in your search query if you did a typo in your search or misspelled something. The results of this suggestion will be in an extendedProperty of the dataset you get as result of your query. No need to fill-up a suggestions dictionnary, FAST provides already a quite big dictionnary of suggestions out-of-the-box.
If what you want is an auto-correction, meaning that your search terms will be corrected, and FAST will do a new search with those new terms, you need that:
query.EnableSpellcheck = SpellcheckMode.On;
Of course, the remaining option if you don't want suggestions nor auto-correction, you specify:
query.EnableSpellcheck = SpellcheckMode.Off;
Or, you don't specify anything, because Off is the default value.
I'm using solr to search for articles. I created 2 test "body" sentences which have the common word "tall", but there is no match.
The Query---> Body:"There are tall people outside" AND !UserId:2
Does not match a post with:
Body: the KU tower is really tall
UserId:3
Is this just simply a very low matching score? or is there something else going on here? In the case of a low matching score should it really be that low? The body sentences are very short and share a common word, I would have expected some match.
EDIT: I think the matching isn't happening as a result of having the !UserId: 2 condition. If I try to match body sentences without that, its very liberal. Can anyone explain this? and perhaps how to best structure a query to avoid this type of specific behavior?
Thanks!
I have seen some funky behavior with the ! operator with Solr. I would suggest you use the - (negative indicator) instead as shown in the SolrQuerySyntax Wiki Page. Try changing your original query to Body:"There are tall people outside" AND -UserId:2 to see if that works as you are expecting.
For those who come after me, I found a solution however not necessarily an explanation for its behavior.
The Solr query:
(PostBody:There are tall people outside) AND !UserId:2
worked as I desired above. Note that if the quotes are added around the body, it does not match. I believe Solr attempts to match such a query as a single string rather than individual words.
I am about to use Solr'd Dynamic Fields for the first time but my requirements state that those fields have to be facetable. I did quite a lot of googling and doc reading but I can't find a place that either confirms or denies the allegation :)
Does anyone here know?
Thanks in advance!
Andre
Yes, you can facet on dynamic fields just fine.