i am getting the following error when trying to use skip and take with examine and razor when saving...
'System.Collections.Generic.IEnumerable' has no applicable method named 'Skip' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax'
Are you using the latest version of Examine? I had to get the new version from codeplex to get skip and take to work properly for me, but now that I have it works mint!
Have you got VS PRo and IIS running locally? Have you tried stepping through the code? If you've got these 2 things, you can skype me and we can talk through it.
oh, Tom, Tom, Tom... you know i am editing this razor script live on the server ;)
i declared a new variable right before the for-each and it is workign as expected... so basically, i have WAY TOO MANY curly braces all over the place that screw up the scope of some variables...
where you've listed the whole script above, you hard coded the page size. Does the error still exist? If it does, the problem lies with the value of currentPage. See what value that has. If you don't want to attach the debugger, hard code it to a one, then just output the value to see what it is. Surround it with something you can quickly find in the output.
At the moment, working with Razor's is painful, mostly due (IMHO) to the fact that the MS compiler isn't very good. It's a v1 after all. Often the error message you get are way off, and usually it's related to mistmatched braces, or forgetting when you need to put in an @ symbol or a code block. Roll on Umbraco 4.7.1, and Razor 1.5sp1.
This dates quite a while back, wasn't the whole issue just the fact that Skip() and Take() need an int value? ie. int number = Convert.ToInt32(@yourValue);
Skip and Take issue with Examine Razor Script
i am getting the following error when trying to use skip and take with examine and razor when saving...
'System.Collections.Generic.IEnumerable' has no applicable method named 'Skip' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax'
here are my using statements...
@using Examine;
@using Examine.LuceneEngine.SearchCriteria;
@using Examine.SearchCriteria;
@using UmbracoExamine;
@using System.Linq;
@using System.Xml.Linq;
oh, and here is my statement...
Are you using the latest version of Examine? I had to get the new version from codeplex to get skip and take to work properly for me, but now that I have it works mint!
:)
hm.... the site is a 4.7 site, but i will check on the latest version issue...
Bob,
This works for me:
That's all my using statements, for this test. You might need to look at how your results variable is being assigned
Tom
i can get it to work with hard coding numbers into the Skip and Take but as soon as i introduce variables, i get the error??? any thoughts?
Maybe it is related to how those variables are declared? Can you show the whole snippet?
here it is in all it's glory ;) -- remember I AM A HACK :)
Have you traced the code to see their values?
This works for me (ignore the fact I'm using page 0)
Have you set itemsPerPage as a parameter in your Macro, and have you givien it a value when inserting the macro?
If you've VS Pro version, add a breakpoint and attach the debugger to your IIS and check the value of itemsPerPage.
yeah, i have no idea how to scope variables, etc. with this junk... and all the curly braces... like i said... I AM A TOTAL HACK :(
Have you got VS PRo and IIS running locally? Have you tried stepping through the code? If you've got these 2 things, you can skype me and we can talk through it.
oh, Tom, Tom, Tom... you know i am editing this razor script live on the server ;)
i declared a new variable right before the for-each and it is workign as expected... so basically, i have WAY TOO MANY curly braces all over the place that screw up the scope of some variables...
i will learn eventually ;)
thanks for ALL your help!
Bob,
where you've listed the whole script above, you hard coded the page size. Does the error still exist? If it does, the problem lies with the value of currentPage. See what value that has. If you don't want to attach the debugger, hard code it to a one, then just output the value to see what it is. Surround it with something you can quickly find in the output.
At the moment, working with Razor's is painful, mostly due (IMHO) to the fact that the MS compiler isn't very good. It's a v1 after all. Often the error message you get are way off, and usually it's related to mistmatched braces, or forgetting when you need to put in an @ symbol or a code block. Roll on Umbraco 4.7.1, and Razor 1.5sp1.
I have a node in XML with the name "productPageTitle" and I dont want this node to be a part of search result.
<ExcludeNodeTypes>
<add Name="titleProperties"/>
</ExcludeNodeTypes>
So I used <ExcludeNodeType> but still as a part of result.
How can I exclude this node from search results?
This dates quite a while back, wasn't the whole issue just the fact that Skip() and Take() need an int value?
ie. int number = Convert.ToInt32(@yourValue);
is working on a reply...