I'm trying to use the 'DemoSearch' usercontrol from umbraco.tv to search through Umbraco's internal Examine/Lucene index. My index is created fine and when I use Luke I see all the stuff I want to see.
Because I want search results for 'foot' also match 'football', I am using like MultipleCharacterWildcard() this:
As you can see, when using the StandardAnalyzer and still using MultipleCharacterWildcard, no '*' get added to the search filter and as a result 'foot' doesn't match 'football'.
When using the WhitespaceAnalyzer I get no search results from Umbraco (though they work in Luke) so I'm forced to use StandardAnalyzer.
Is there a way to get Examine to add wildcards to my search query when using the StandardAnalyzer?
You need to pass in the IExamineValue object, not the generated string, otherwise Lucene doesn't know it's a wildcard query you're trying to cut and it'll strip out the '*' as it deems it illegal
Examine 1.0 RTM Analyzer
I'm trying to use the 'DemoSearch' usercontrol from umbraco.tv to search through Umbraco's internal Examine/Lucene index. My index is created fine and when I use Luke I see all the stuff I want to see.
Because I want search results for 'foot' also match 'football', I am using like MultipleCharacterWildcard() this:
I am aware of the case-sensitivity issue/change in Examine 1.0 (Using v1.0 RTM on Umbraco 4.5), but I'm running into something weird.
When I use Lucene.Net.Analysis.WhitespaceAnalyzer the searchcriteria look like this:
When I use Lucene.Net.Analysis.Standard.StandardAnalyzer the searchcriteria look like this:
As you can see, when using the StandardAnalyzer and still using MultipleCharacterWildcard, no '*' get added to the search filter and as a result 'foot' doesn't match 'football'.
When using the WhitespaceAnalyzer I get no search results from Umbraco (though they work in Luke) so I'm forced to use StandardAnalyzer.
Is there a way to get Examine to add wildcards to my search query when using the StandardAnalyzer?
You need to pass in the IExamineValue object, not the generated string, otherwise Lucene doesn't know it's a wildcard query you're trying to cut and it'll strip out the '*' as it deems it illegal
Thanks for the reply slace, but I'm not sure I understand.
I am not adding any '*' manually, as I know that won't work. That's why my code has 'MultipleCharacterWildcard()'.
The searchcriteria valus I listed are generated, and I wanted to know how to get the wildcard behaviour when using StandardAnalyzer.
You're accessing the Value property of the IExamineValue, that's returning just a string so it's not being treated as a Lucene object by the analyzer
No no, I just had that value printed to the page and listed here to show what happens when I leave my code untouched but change the analyzer.
This is the actual code:
You're doing this:
But you should do this:
Notice the change to the end of the 2nd line
Thank you so much slace, both for your help here and Examine itself.
I can't believe I missed that '.Value'! Odd that it worked fine with .Value using the WhitespaceAnalyze though.
It's because when the WhitespaceAnalyzer parses the query it doesn't remove the '*' from it, but the StandardAnalyzer will remove it.
Can somebody tell me what I'm doing wrong?
It won't recognise MultipleCharacterWildcard() as a valid string extension so I cannot compile it.
I have references to Examine & UmbracoExamine and the folowing code:
Thanks, Matt
is working on a reply...