Knowledgebase Home Page  >  SearchUnit  >  Version 2 Articles
Search the Knowledge Base
How can I inject my own word 'variations' into a search? (C#)
https://keyoti.com/kb/Default.aspx?ToDo=view&questId=152&catId=66

Options

Print this page
Email this to a friend
By default the search engine looks up 'variations' or lemmas and searches for those as well as each keyword.  Doing this means that other forms (plurals, past tense etc) are matched as well as the keyword.  Lemmas are weighted less that the original keyword, according to the Configuration.lemmaWeightFactor property.
 
 
It's easy to pass your own list of alternatives.  So for example if you wanted to inject the words "the" and "word" as synonyms you could do this to your SearchResult page, code behind.
 

private void Page_Load(object sender, System.EventArgs e)

{

SearchResult1.SearchAgent.DataAccess = new CDataAccess();

}

class CDataAccess : Keyoti.SearchEngine.DataAccess.XmlDataAccess

{

public override ArrayList GetWordVariations(Keyoti.SearchEngine.DataAccess.Word word)

{

//English lemmas return base.GetWordVariations (word);

return new ArrayList(new string[]{"the", "word"});

}

}

In this example we don't care what word is, but you can easily read the word and lookup appropriate synonyms, and then just put them in the ArrayList.

Related Questions:

Attachments:

No attachments were found.