i´m a bit lost right now. I´m trying to create an index with examine, and i need the analyser to accept lowercase. Ex. I need Examine to find the word "Exception" when i search for "exception". I have read some forum posts, where Slace recomends using the StandardAnalyzer for both the indexer and the searcher (http://our.umbraco.org/forum/developers/extending-umbraco/14449-Examine-Search-Incase-sensitive). I have tried that, and it still won´t work. The wird part is, that if i use the searchbox in the backend it finds words, even though the search is in lower case.
I have rebuild the index (deleted folder + save & publish) with the StandardAnalyzer.
I have also tried to open the index in Luke, and do a search on bodyText with StandardAnalyzer. Result: no luck!
if I for example search for the name "rasmus" in the field bodyText with the StandardAnalyzer i get two results. But no results doing the same with the code above.
after the query.Compile() statement can you do a criteria.ToString() and write that out and paste here it should give you the actual lucene query generated. compare that query with what actually works with luke see if you can see any issues there.
into luke and fiddle with it until you figure out what is stopping it from working. One thing i do with my indexes is add all the fields content into one combined field called contents and do search on that. The advantage of this is i dont have to do group query i can just query on that one contents field so my query ends like contents:blah* +__IndexType:content
what is the analyser being used in luke standard? You can get disparity with results when using different analysers usually if using whitespace and standard if both same in your code and luke then you should get same results.
with regards to combined field you need to implement gatheringnode method and inject combined field in there see slaces cg10 examine demo for sample code or if your really stuck i can paste some code for you.
found the problem. Even though i have assigned the provider in the code it wouldn´t work (see below). Then when i changed the defaultProvider for ExamineSearchProviders to the new searcher it worked exactly as in Luke
var criteria = ExamineManager.Instance.SearchProviderCollection[ExamineSearchName].CreateSearchCriteria(UmbracoExamine.IndexTypes.Content);
Once again, thanks a lot Ismail, you really helped me understand Examine better. I´ll buy you a drink at CG11 ;-)
Examine confusion
Hi there,
i´m a bit lost right now. I´m trying to create an index with examine, and i need the analyser to accept lowercase. Ex. I need Examine to find the word "Exception" when i search for "exception". I have read some forum posts, where Slace recomends using the StandardAnalyzer for both the indexer and the searcher (http://our.umbraco.org/forum/developers/extending-umbraco/14449-Examine-Search-Incase-sensitive). I have tried that, and it still won´t work. The wird part is, that if i use the searchbox in the backend it finds words, even though the search is in lower case.
I have rebuild the index (deleted folder + save & publish) with the StandardAnalyzer.
I have also tried to open the index in Luke, and do a search on bodyText with StandardAnalyzer. Result: no luck!
The code for the searchpage looks like this:
SearchTerm = Request.QueryString["q"].Trim().ToLower();
string[] searchFields = FieldsToSearh.Split(',');
if(string.IsNullOrEmpty(SearchTerm)) return;
var criteria = ExamineManager.Instance
.SearchProviderCollection[ExamineSearchName]
.CreateSearchCriteria(UmbracoExamine.IndexTypes.Content);
var query = criteria
.GroupedOr(searchFields, SearchTerm)
.Or()
.GroupedOr(searchFields, SearchTerm.MultipleCharacterWildcard())
.Not()
.Field("umbracoNaviHide", "1");
SearchResults = ExamineManager.Instance.Search(query.Compile()).Distinct();
SearchCount = SearchResults.Count();
SearchResultListing.DataSource = SearchResults;
SearchResultListing.DataBind();
Actually i belive it worked before i upgraded the solution to 4.6.1, but i´m not sure.
Can anyone help me with this one?
Cheers
René
Rene,
What you do get when you query with luke? http://www.getopt.org/luke/
Hi Ismail,
if I for example search for the name "rasmus" in the field bodyText with the StandardAnalyzer i get two results. But no results doing the same with the code above.
Thanks
René
Are you using the latest Examine from codeplex?
Regards
Ismail
I use the on that came with Umbraco 4.6.1. Actually i think it worked before i upgradet to 4.6.1
René
after the query.Compile() statement can you do a criteria.ToString() and write that out and paste here it should give you the actual lucene query generated. compare that query with what actually works with luke see if you can see any issues there.
Regards
Ismail
Thanks for you input. Here is the output from my search:
{
SearchIndexType: content,
LuceneQuery: +(+(
nodeName:rasmus
bodyText:rasmus
medarbejderFornavn:rasmus
medarbejderEfternavn:rasmus
medarbejderEmail:rasmus) (
nodeName:rasmus*
bodyText:rasmus*
medarbejderFornavn:rasmus*
medarbejderEfternavn:rasmus*
medarbejderEmail:rasmus*)
-umbracoNaviHide:1) +__IndexType:content }
Is there a way to se the compiled search from Luke?
Regards
René
Rene,
Try pasting that query i.e.
+(+(
nodeName:rasmus
bodyText:rasmus
medarbejderFornavn:rasmus
medarbejderEfternavn:rasmus
medarbejderEmail:rasmus) (
nodeName:rasmus*
bodyText:rasmus*
medarbejderFornavn:rasmus*
medarbejderEfternavn:rasmus*
medarbejderEmail:rasmus*)
-umbracoNaviHide:1) +__IndexType:content
into luke and fiddle with it until you figure out what is stopping it from working. One thing i do with my indexes is add all the fields content into one combined field called contents and do search on that. The advantage of this is i dont have to do group query i can just query on that one contents field so my query ends like contents:blah* +__IndexType:content
Regards
Ismail
Thanks Ismail,
i really preciate your help. When i put the query in Luke i get results?!?! What is the differens between my search and Luke?
How do you combine the fields content into one combined field? In the index or in the search control (usercontrol)?
what is the analyser being used in luke standard? You can get disparity with results when using different analysers usually if using whitespace and standard if both same in your code and luke then you should get same results.
with regards to combined field you need to implement gatheringnode method and inject combined field in there see slaces cg10 examine demo for sample code or if your really stuck i can paste some code for you.
Hi again,
found the problem. Even though i have assigned the provider in the code it wouldn´t work (see below). Then when i changed the defaultProvider for ExamineSearchProviders to the new searcher it worked exactly as in Luke
var criteria = ExamineManager.Instance.SearchProviderCollection[ExamineSearchName].CreateSearchCriteria(UmbracoExamine.IndexTypes.Content);
Once again, thanks a lot Ismail, you really helped me understand Examine better. I´ll buy you a drink at CG11 ;-)
Cheers
René
is working on a reply...