Have you had a peek at your index with Luke ? Just to see if there is something general you can search for.
I actually had the same question a week ago and Ismail was kind enough to tell me how to solve it. Could you please try something like:
var mySearcher = ExamineManager.Instance.SearchProviderCollection["MySearcher"]; var criteria = mySearcher.CreateSearchCriteria(IndexTypes.Content); var results = mySearcher.Search(criteria.Compile());
I had a similar issue but I had a flag (IsPublic) I was able to add and perform a search based on that being 1. Equally you could try a search for an id > 0 I imagine.
The Umbrac video series re Examine is very useful too, just to make sure the index is all set up right and shows you how to use Luke.
Thanks for the tip, I couldn't quite get that code working, but got it to work like so:
var searcher = ExamineManager.Instance.SearchProviderCollection[examineSearcher];
var searchCriteria = searcher.CreateSearchCriteria(IndexTypes.Content);
var results = searcher.Search(searchCriteria.SearchIndexType, true);
Barry, I thought of doing something like that, but wanted to do more of a select * type thing than fake it by searching on a field, thanks anyway
I couldn't get either of these to work, but Ismail mentioned a tip at his Umbraco UK Fest presentation. The idea was to use the GatheringNodeData event to add a "dummy" field to all nodes, then you can query for this field. Here's my event, and my search just looks for allDocs = 1
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Examine; using umbraco.businesslogic;
namespace Client.Umbraco.Extensions.Events { public class CenterSearch : ApplicationStartupHandler { public CenterSearch() { ExamineManager.Instance.IndexProviderCollection[Constants.INDEXER_NAME].GatheringNodeData += CenterSearch_GatheringNodeData; } void CenterSearch_GatheringNodeData(object sender, IndexingNodeDataEventArgs e) { // Add a dummy value so its easy to get all docs e.Fields.Add("allDocs", "1"); // Other stuff } } }
Getting all items from an examine index
I'm using Examine to server content in v4.7.1 (for performance reasons). I want to be able to get all of the items in a particular index
I've tried
var results = ExamineManager.Instance.SearchProviderCollection["MySearcher"].Search(string.Empty, true);
but it throwns an error.
How can get all the items in the index?
Hi Euan,
Have you had a peek at your index with Luke ? Just to see if there is something general you can search for.
I actually had the same question a week ago and Ismail was kind enough to tell me how to solve it. Could you please try something like:
See if that gives any results at all :-)
All the best,
Bo
I had a similar issue but I had a flag (IsPublic) I was able to add and perform a search based on that being 1. Equally you could try a search for an id > 0 I imagine.
The Umbrac video series re Examine is very useful too, just to make sure the index is all set up right and shows you how to use Luke.
Hi Bo,
Thanks for the tip, I couldn't quite get that code working, but got it to work like so:
Barry, I thought of doing something like that, but wanted to do more of a select * type thing than fake it by searching on a field, thanks anyway
Cheers,
Euan
Hi Euan,
Brilliant! Remember to mark your post as 'Solved' for future reference :-)
- Bo
I couldn't get either of these to work, but Ismail mentioned a tip at his Umbraco UK Fest presentation. The idea was to use the GatheringNodeData event to add a "dummy" field to all nodes, then you can query for this field. Here's my event, and my search just looks for allDocs = 1
-Tom
I ended up doing it like this:
is working on a reply...