We are using full text search with an advanced query.Our map:Map = searchDocuments => searchDocuments.Select(searchDocument =>new{FullTextSearch = new object[]{searchDocument.FirstName,searchDocument.LastName,searchDocument.CompanyName}});Index(x => x.FullTextSearch, FieldIndexing.Analyzed);Our Query (with a search document class as the result)using (var session = DocumentStore.OpenSession()){var advancedQuery = session.Advanced.LuceneQuery<SearchDocument, SearchDocumentIndex>();advancedQuery = advancedQuery.Where("FullTextSearch: *" + searchTerm + "*");RavenQueryStatistics stats;
var results = advancedQuery.Statistics(out stats).Skip(pageSize * pageNumber).Take(pageSize).ToArray();return new PagedQueryResult<SearchEntity>(pageSize, stats.TotalResults){PageNumber = pageNumber + 1,PageValues = results.Cast<SearchDocument>()};}Is there a way to have the results return from an advanced query sorted by the lucene score or best matched? I've read in the documentation that if no sort is specified then the results are returned Lexical. I've also seen some Google group posts that the default is to returned by the meta data Temp-Index-Score. In my tests the results are sorted by last updated descending (last updated, last). I need the results to be returned in order of Lucene score, highest first. Any help would be appreciated.
var fuzzyTerms = String.Concat(String.Join("~ ", searchTerms.Split()), "~"); advancedQuery = advancedQuery.Search("FullTextSearch", fuzzyTerms);