0
votes

I am trying to search in Solr Instance with :

\\123.45.67.89\Lists\PLAYLIST\EAST

and it would return me results like:

Some Text: \\123.45.67.89\Lists\SAVELIST\ATTTA
Some Text: \\123.45.67.89\lists\PLAYLIST\ABC
Some Text: \\172.21.52.41\Lists\PLAYLIST\EAST

I am sorting based on relevant score and ID field.

It seems that instead of returning exact matches first, Solr somehow splits everything in search term and then returns those which has the highest score for each term. I am using Text_general filed type. I am sending query through SolrNet like:

SolrQueryByField query = new SolrQueryByField("body", @"\\123.45.67.89\Lists\PLAYLIST\EAST");
solrQuery = solr.Query(query, new QueryOptions
{
    Rows = 100,
    Start = 0,
    OrderBy = new[] {new SortOrder("ID", Order.DESC), new SortOrder("score", Order.DESC) },

});

If I swap the sort order with relevance first and then ID second then it just ignores the latest records existing in the solr instance and would return older records (2-3 days old) instead of latest records with the same text. (ID is auto increment number and shows latest records in order by desc)

My field has different types of text ranging from XML, to text and some containing URL an file paths etc.

My Question:

Is there a way to modify Solr scoring method, so that exact matches are scored higher than frequency of each search terms splitted on \ or .?

2

2 Answers

0
votes

try indexing the specific field with the following analyzer: http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.PathHierarchyTokenizerFactory text_general is not good for file paths

0
votes

I have been able to found the way to get relevant results. I need to Boost the query. I did:

SolrQueryByField query = new SolrQueryByField("body", @"\\123.45.67.89\Lists\PLAYLIST\EAST");
query.Boost(100);

and that resulted in exact matches being returned first.