Are you matching multiple ID's here? Sorry to jump on this post but seems to be almost what I need but I'm having trouble understanding this code.
It looks like your CSV values being passed in via the querystring?
I have a bunch of ID's selected from MNTP set to CSV, I split these and get them into the examine index ok, but I don't know that the examine statement to search them.
I have these values from my MNTP "1010,1012,1020" I need to find results only where ALL these nodes have been selected.
Hope this makes sense and that it has something to do with this post...
You should attach to the GatheringNodeData event and split the CSV on "," and replace it with " ". This way they are indexed individually and can be searched individually.
I have a product search page and users can search on bunch of fields. I also have a supplier page and they have link called products offered by supplier. Each supplier has using MNTP a bunch of products set so the link has href /product-search?ids=1234,1235,3445 on results page i perform query as per Slaces suggestion and it works nicely. The productsoffered should be in index as field but its not however as the product ids are node ids i can search on id or __NodeId and it works.
Rich - Start a new thread so your problem doesn't get lost in this one and it's easier for others to if they have your problem in the future :). Flick it to me on twitter once you're done :)
Examine node id or question
Guys,
I need to do a node range query using examine i have csv list of nodes so want all nodes with the values in the list i am doing something like
when i pass in 2 ids i should get 2 results but get more the query that is generated looks like
+(+nodeTypeAlias:product __NodeId:1217 __NodeId:1328) +__IndexType:content
its not restrictive enough becuase its matching on nodetypealias.
Regards
Ismail
You want to AND a GroupedOr statement onto the nodeTypeAlias check, so in plane english what your query looks like is:
When NodeTypeAlias is Product and NodeId is in the CSV
So you want to build a Lucene query like this:
(and then append the index type check)
Try this: (I think that the indexer class exposes a property which is the magic string for NodeId so you don't have to hard-code it)
if (Request.QueryString["id"]!=null)
{
string[] ids = Request.QueryString["id"].Split(new char[] {','});
query = query.And().GroupedOr(ids.Select(x => "__NodeId"), ids);
}
Slace,
Awesome that worked a treat!
Regards
Isamil
Hey Ismail,
Are you matching multiple ID's here? Sorry to jump on this post but seems to be almost what I need but I'm having trouble understanding this code.
It looks like your CSV values being passed in via the querystring?
I have a bunch of ID's selected from MNTP set to CSV, I split these and get them into the examine index ok, but I don't know that the examine statement to search them.
I have these values from my MNTP "1010,1012,1020" I need to find results only where ALL these nodes have been selected.
Hope this makes sense and that it has something to do with this post...
Cheers
Rich
You should attach to the GatheringNodeData event and split the CSV on "," and replace it with " ". This way they are indexed individually and can be searched individually.
Hey Slace,
I've done that bit and they are indexed separately, however I don't know what examine search term to use?
Cheers
Rich
Rich,
I have a product search page and users can search on bunch of fields. I also have a supplier page and they have link called products offered by supplier. Each supplier has using MNTP a bunch of products set so the link has href /product-search?ids=1234,1235,3445 on results page i perform query as per Slaces suggestion and it works nicely. The productsoffered should be in index as field but its not however as the product ids are node ids i can search on id or __NodeId and it works.
Regards
Ismail
Rich - Start a new thread so your problem doesn't get lost in this one and it's easier for others to if they have your problem in the future :). Flick it to me on twitter once you're done :)
Thank you Slace & Ismail.
Added a thread to a post I started a while back, linked here for anyone looking http://our.umbraco.org/forum/developers/extending-umbraco/12345--MultiNodePicker-Examine hopefully explains my problem clearly.
Rich
is working on a reply...