//TODO needs to be fixed so that checkbox search can be done
query = searchCriteria.Range("bidPrice", paddedLower, paddedHigher, true, true).And().Field("categoryPath",searchCategory).Or().Field("nodeName",searchCategory.Fuzzy()).Or().Field("nodeName", q.Fuzzy()).Or().Field("description", q.Fuzzy());
But no results are getting returnned, can anyone see what I'm doing wrong, I have rebuild the index, but no luck.
By default Umbraco will add a field called ParentID to the index. Based on your structure you should be able to search against that field without having to do any manipulation of the path. This is probably an easier route for you in this situation.
If you allow more than one category to be selected at once then you could use the GroupedOr() method which allows you to pass in multiple IDs to search against. It would look something like this:
query = searchCriteria.Range("bidPrice", paddedLower, paddedHigher, true, true)
.And().GroupedOr(new string[] { "ParentID" }, new string[] { "CategoryIDOne", "CategoryIDTwo" }) //This is the key line
.Or().Field("nodeName", searchCategory.Fuzzy())
.Or().Field("nodeName", q.Fuzzy())
.Or().Field("description", q.Fuzzy());
Hopefully this is along the lines of the functionality you are looking for.
Thanks for the reply, I managed to solve the problem in my case I had to use the following
.Field("__Path",searchCategory)
No idea why but that worked, and as really pushed for time did not have time to find out why. All I know is that in Lucene /Examine the field in the raw data is named __Path.
Filter Lucene search results under document type
Hi
I have a structure like the following
category (Boots)
----itemsForSale (addidas)
category (Socks)
----itemsForSale (long)
Where Boots is the name of the category doctype and Adidas is the name for the itemsForSale doctype etc.
Now if a visitor to the site selects the Boots category from the checkbox options, I pass the id to the search page
The visitor can also search via keyword and min, max price.
That keyword min,max price option works, I just cannot get the search to work so that it only displays items under the parent, i.e Addidas.
I have the following code:
ExamineIndex
OnGatheringNodeData
And my search is as follows:
But no results are getting returnned, can anyone see what I'm doing wrong, I have rebuild the index, but no luck.
Thanks in advance
George
Hi George,
By default Umbraco will add a field called ParentID to the index. Based on your structure you should be able to search against that field without having to do any manipulation of the path. This is probably an easier route for you in this situation.
If you allow more than one category to be selected at once then you could use the GroupedOr() method which allows you to pass in multiple IDs to search against. It would look something like this:
Hopefully this is along the lines of the functionality you are looking for.
Paul
Hi Paul
Thanks for the reply, I managed to solve the problem in my case I had to use the following
No idea why but that worked, and as really pushed for time did not have time to find out why. All I know is that in Lucene /Examine the field in the raw data is named __Path.
Regards George
is working on a reply...