Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Barry Fogarty 493 posts 1129 karma points
    Nov 27, 2012 @ 21:59
    Barry Fogarty
    0

    Combined Examine index containing media, content, members

    I would like to create a single queryable index that stores some basic properties of media, members and content.  Is this feasible?  Or do I need to combine the reuslts of different queries.

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Nov 27, 2012 @ 22:09
    Morten Bock
    0

    I think you would need to create a custom indexer. Maybe take a look at the source of the existing ones:

    http://examine.codeplex.com/SourceControl/changeset/view/fc526605aab6#Projects%2fUmbracoExamine%2fUmbracoMemberIndexer.cs

    With a custom indexer, you could store a common set of fields for all types, and then use that to do your query.

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Nov 28, 2012 @ 09:31
    Ismail Mayat
    1

    Barry,

    You need todo a multi index search

    private MultiIndexSearcher searcher;

    searcher = WebHelpers.GetMultiSearcher(new[] {"index1", "index2"}); //replace with your indexers

            public static MultiIndexSearcher GetMultiSearcher(string[] indexes)

            {

                var directories = new List<DirectoryInfo>();

                foreach (var index in indexes)

                {

                    var indexer = ExamineManager.Instance.IndexProviderCollection[index];

                    var dir = new DirectoryInfo(((LuceneIndexer)indexer).LuceneIndexFolder.FullName.Replace("\\Index",""));

                    directories.Add(dir);

     

                }

                var i = new MultiIndexSearcher(directories, new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29));

                return i;

            }

    The method i have to get the indexers is not optimal sure there is a better way of getting the directories on the bit (LuceneIndexer)indexer) im sure if you cast it to UmbracoBaseIndexer you can get the directory path of index? Anyhow what I have definately works as I am using it on a site where I am searching across umbraco and database indexes.

    Also what you may want todo to make queries less terse is use GatheringNodeData event on each index and munge all the fields into new field called content then your query will be short and sweet!

    Regards

     

    Ismail

  • Adi 79 posts 183 karma points
    Feb 15, 2014 @ 21:39
    Adi
    0

    Hello Ismail,

    I am trying to do something similar as Barry described, please see this topic

    http://stackoverflow.com/questions/21710897/umbraco-fulltextsearch-including-search-of-media-section/21745080?noredirect=1#21745080

    Can you give me some pointers, I am lost over here;(

    All the best, Adi

Please Sign in or register to post replies

Write your reply to:

Draft