An alternative would be a custom SearchComponent that post-processes hits. Otis Solr & ElasticSearch Support http://sematext.com/ On Apr 30, 2013 10:27 AM, "Sandeep Mestry" <sanmes...@gmail.com> wrote:
> Thanks Erick, > > I tried grouping and it appears to work okay. However, I will need to > change the client to parse the output.. > > &fq=title:(tree)&group=true&group.query=title:(trees) NOT > title_ci:trees&group.query=title_ci:blair&group.sort=title_sort > desc&sort=score desc,title_sort asc > > I used the actual query as the filter query so my scores will be 1 and then > used 2 group queries - one which will give me exact matches and other that > will give me partial minus exact matches. > I have tried this with operators too and it seems to be doing the job I > want, do you see any issue in this? > > Thanks again for your reply and by the way thanks for SOLR-4662. > > -S > > > On 30 April 2013 15:06, Erick Erickson <erickerick...@gmail.com> wrote: > > > I don't think you can do that. You're essentially > > trying to mix ordering of the result set. You > > _might_ be able to kludge some of this with > > grouping, but I doubt it. > > > > You'll need two queries I'd guess. > > > > Best > > Erick > > > > On Mon, Apr 29, 2013 at 9:44 AM, Sandeep Mestry <sanmes...@gmail.com> > > wrote: > > > Dear Experts, > > > > > > I have a requirement for the exact matches and applying alphabetical > > > sorting thereafter. > > > > > > To illustrate, the results should be sorted in exact matches and all > > later > > > alphabetical. > > > > > > So, if there are 5 documents as below > > > > > > Doc1 > > > title: trees > > > > > > Doc 2 > > > title: plum trees > > > > > > Doc 3 > > > title: Money Trees (Legendary Trees) > > > > > > Doc 4 > > > title: Cork Trees > > > > > > Doc 5 > > > title: Old Trees > > > > > > Then, if user searches with query term as 'trees', the results should > be > > in > > > following order: > > > > > > Doc 1 trees - Highest Rank > > > Doc 4 Cork Trees - Alphabetical afterwards.. > > > Doc 3 Money Trees (Legendary Trees) > > > Doc 5 Old Trees > > > Doc 2 plum trees > > > > > > I can achieve the alphabetical sorting by adding the title sort > > > parameter, However, > > > Solr relevancy is higher for Doc 3 (due to matches in 2 terms and so > > > it arranges > > > Doc 3 above Doc 4, 5 and 2). > > > So, it looks like: > > > > > > Doc 1 trees - Highest Rank > > > Doc 3 Money Trees (Legendary Trees) > > > Doc 4 Cork Trees - Alphabetical afterwards.. > > > Doc 5 Old Trees > > > Doc 2 plum trees > > > > > > Can you tell me an easy way to achieve this requirement please? > > > > > > I'm using Solr 4.0 and the *title *field is defined as follows: > > > > > > <fieldType name="text_wc" class="solr.TextField" > > positionIncrementGap="100" > > >> > > > <analyzer type="index"> > > > <tokenizer class="solr.WhitespaceTokenizerFactory"/> > > > <filter class="solr.WordDelimiterFilterFactory" > > > stemEnglishPossessive="0" generateWordParts="1" generateNumberParts="1" > > > catenateWords="1" catenateNumbers="1" catenateAll="1" > > splitOnCaseChange="1" > > > splitOnNumerics="0" preserveOriginal="1" /> > > > <filter class="solr.LowerCaseFilterFactory"/> > > > </analyzer> > > > <analyzer type="query"> > > > <tokenizer class="solr.WhitespaceTokenizerFactory"/> > > > <filter class="solr.WordDelimiterFilterFactory" > > > stemEnglishPossessive="0" generateWordParts="1" generateNumberParts="1" > > > catenateWords="1" catenateNumbers="1" catenateAll="1" > > splitOnCaseChange="1" > > > splitOnNumerics="0" preserveOriginal="1" /> > > > <filter class="solr.LowerCaseFilterFactory"/> > > > </analyzer> > > > </fieldType> > > > > > > > > > > > > Many Thanks in advance, > > > Sandeep > > >