0

I created a index of cities with the following properties

  1. Name
  2. Population
  3. Country

With the following code I can run searches and got results

var parser = new QueryParser(Lucene.Net.Util.Version.LUCENE_30, "Name", analyzer);

Query query = parser.Parse(searchTerm);

TopScoreDocCollector result = TopScoreDocCollector.Create(resultCount, true);
searcher.Search(query, result);

For example, when I run Berlen~ as a fuzzy query I got some results. But the city Berlin -with highest Population- is some where in the middle. How can I influence the query to have cities with higher population value to get a higher score?

Assem
  • 11,574
  • 5
  • 59
  • 97
Boas Enkler
  • 12,264
  • 16
  • 69
  • 143

1 Answers1

1

The default order of results is by relevance (score). What you should do is not manipulating score to change the order but it is sorting results by Population field.

Check Sorting search result in Lucene based on a numeric field

Community
  • 1
  • 1
Assem
  • 11,574
  • 5
  • 59
  • 97