Hello. I am having trouble getting a c# program to work the way that I want it to. The general idea of the program is to search the systemindex for certain text values.
I can not figure out how to prevent partial text matches.
For example:
If I search for car, I do not want to see carpenter or car_sales...
However, I don't want to just add a space to the end of car ("car ") because I don't want to skip code that could end like car) or car;
If I had access to what the index hit on, I could programmatically handle it, but I can't figure it out.
Any help would be very much appreciated.
By the way, does anyone know of a resouce that actually lists and explains the SystemIndex catalog and its properties?
Thanks In Advance,
Larry
-
-
I doubt, the search would return any carpenter or car_service because that would implies wildcard search. Wildcard search must typically be explicit (using the * operator). What you probably get are variations of the word, such as cars, or run =>running, ran, runs, etc... That's called stemming.
I don't know the specifics of WDS 3, but look at the API if you can disable stemming when executing searches. With stemming disabled, you should get what you want.
By default, these symbols: ) ? : , ; = are considered word breakers so the search engine will always detect the variable 'car' properly in lines such as
if(car)
upgrade(car)
money > x ? car=porche : car=pos
x=car; -
I'm not sure this is very relevant but I thought I read somewhere that this sample app did some integration with Windows Desktop Search so it may offer some pearls of value for you.
Perhaps not either though. -
Thanks for your reply. I really appreciate your time.
I will look into stemming. However, it does infact return carpenter. I thought that I had pasted a code sample, but apparently I did not. Perhaps I am doing something wrong?
Here is the code snippet:
string query = " SELECT " +
" system.filename " +
" ,System.FileExtension " +
" ,System.ItemFolderPathDisplay " +
" FROM SystemIndex " +
" WHERE contains('" + searchString + "')";
I have also tried this where clause:
// " WHERE contains('" + '"' + searchString + '"' + "')";
But
Let's suppose I have 3 files:
File Name contents
test1.txt I drive a car.
test2.txt I am a carpenter.
test3.txt insert into car_list .....
If I run this query with searchString = "car", I get all 3 files as results.
Is there anyway to see what it is matching on? Something like matched content on string...? -
Thanks nosjis. To which app are you referring?
-
Update:
If I seach with quotes around the string, WDS will not return carpenter, but it still returns car_list.
Larry -
I have been looking into the stemming and word breakers.
From what I can gather, the only way that this can work is if I add the underscore as a word breaker. However, I can not find out how to do this.
Would I have to create an ifilter for each file type or can I just add the underscore somewhere?
Thanks,
Larry
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.