Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Is it possible to filter the Lucene PrefetchList Picker with multiple properties, such as found in the Lucene documentation?
title:"The Right Way" AND text:go
Reference: Lucene Keyword matching
I'm trying to filter two properties but when I add the "AND" to the raw query, the Prefetch List disappears.
Can you post your exact query instead of the one copied from the Lucene docs.
That makes it more easy to spot issues.
Here's the raw query
Thing_highlight_:1 AND umbracoNaviHide:0
My goal is to also add a verification for highlight date like this
AND Thing_highlight_until_ > DateTime.Now
But no point in going that far, until I get the first two working..
I have also checked to make sure all nodes have Thing_highlight_ and umbracoNaviHide and yet as soon as I add umbracoNaviHide the whole List disappears.
Does it have issues if I use underscore?
You may have already confirmed this but when you say you checked the node has umbracoNaviHide have you checked this property is being indexed. What results are returned if you use the same query in luke the utility for testing lucene? I think you could also test the query in the umbraco backoffice in the dashboard
Thanks @Ian , after trying Luke, I've noticed that saving and publishing wasn't actually recording the umbracoNaviHide Property. After setting umbracoNaviHide to 1 then back to 0, Luke picked it up. And, so did the Prefetch List.
Now it showed up.
My issue now: Is it possible to filter by Date?
Background: Articles and News (DocumentTypes) have an Expire Date (when it stops showing up as a new item), done with the Thing_highlight_until_ property.
I need to have only the items that are still valid (not expired) to show up in the Prefetch List.
Is that possible?
Yes i m sure you can.index dates though i would say the purpose of lucence is as a text search. I havent used umbraco since leaving my employer, so the best i can do is say have a look at this https://our.umbraco.org/forum/developers/extending-umbraco/28796-Examine-Searching-for-Events-that-fall-between-a-given-date.
I would also say at this point is the lucene.picker really the best for you when the .net picker would allow you to write a very simple class with some linq in it to do your filtering on properties and dates
I have implemented the list using .NET. Thanks!
In addition, since I haven't found much of code samples for DotNet Prefetch Lists, I'm posting my code here, maybe it will serve as a reference for someone else.
public class Home_Slider : IDotNetDataSource
UmbracoHelper helper = new UmbracoHelper(UmbracoContext.Current);
IEnumerable<KeyValuePair<string, string>> IDotNetDataSource.GetEditorDataItems(int contextId)
List<KeyValuePair<string, string>> list = new List<KeyValuePair<string, string>>();
DynamicPublishedContent node = helper.Content(contextId);
var children = node.Descendants().ToList().Where(x => x.GetPropertyValue<int>("Thing_highlight_") == 1 && x.GetPropertyValue<int>("umbracoNaviHide") == 0 && x.GetPropertyValue<DateTime>("Thing_highlight_until_") > DateTime.Now);
foreach (var child in children) list.Add(new KeyValuePair<string, string>(child.Id.ToString(), child.Name));
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted