Developer forum

Forum » Development » Prioritize first word of a search

Prioritize first word of a search

Tomas Gomez
Reply

Hi,

Our client wants to prioritize the first word of a search when a user looks for several words. For instance, to prioritize the results containing "microwave" when looking for "microwave small". NOTE: It has more sense in Spanish, as the noum "microwave" will be always before the adjective "small".

In the configuration of the repositories indexes is possible to prioritize according the searched fields, but not according the searched terms.

Which is best way to do this priorization?

Regards,
Tomas


Replies

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Tomas,

 

In portuguese it's the same concept, but regardsless of it, you cannot do that in Lucene as far as I know.

 

You can set up an expression with a "Contains" operator on an field that is not analyzed, which allows you to find documents that match that exact string of characters (in your case "small microwave" - in other words the expression would not find "small practical microwave", but others would). But the "contains" operator does not account for scoring, so it cannot be used to "prioritize" results.

 

Scoring only happens with exact mathes, so only operators "Equal", "In", "MatchAny" and "MatchAll" work for scoring (prioritization) purposes.

 

You'll find other challenges when searching for multiple "words", because you can't determine when the user is typing 2 terms "microwave grill" (trying to search for "microwave" + the word "grill" vs a compound term ("small microwave"). With that in mind, you can hopefully guide the customer into another solution.

 

Best Regards,

Nuno Aguiar

 

You must be logged in to post in the forum