Products
RapidSpell Desktop .NET (Win Forms)
RapidSpell Web ASP.NET (ASP.NET, MVC, SPA)
RapidSpell WPF
RapidSpell Web Java (JSP, JSF)
RapidSpell Desktop Java (Swing)
SearchUnit
RapidFindReplace WPF
Dictionaries for .NET
Dictionaries for Java
Conveyor
Customer Care
Existing Customers
Support
Knowledge Base
Company
Home
About
Blog
Contact Us
Refund Policy
Support Policy
Privacy Policy
Home
KB
Knowledgebase Home Page
>
SearchUnit
>
Version 2 Articles
Search the Knowledge Base
-- Select a Category --
- RapidFindReplace WPF
- RapidSpell Desktop .NET
- 3rd Party Ctrls
- Appearance Customization
- Behavior Customization
- Misc
- Troubleshooting
- RapidSpell Desktop Java
- RapidSpell Silverlight
- RapidSpell Web ASP.NET
- Appearance Customization
- Behavior Customization
- Misc
- Rich/HTML Textboxes
- Troubleshooting
- RapidSpell Web Java
- SearchUnit
- Version 2 Articles
- Version 3 Articles
- Thesaurus Desktop .NET
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:
How can I use Search for ASP.NET without Visual Studio (version 2)?
How do I programmatically crawl a website? (C#)
How can I index files on my local filesystem? (VB.NET)
How can I programmatically filter results according to my own logic? (C#)
How can I find the number of matches of a word in a document?
Attachments:
No attachments were found.