Copied to clipboard

Flag this post as spam?

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


  • Nick 37 posts 130 karma points
    Aug 07, 2013 @ 14:08
    Nick
    0

    Search both content and PDF's in a single examine query?

    Hi,

    I am using Examine to search the site but currently the search is not returning PDF's that are stored in the Media folder.

    In looking at the documentation it looks like I have to create a seperate Indexer and associated Searcher and IndexSet to specifically handle indexing PDF's.

    If I do this then how can I create a search that combines both the site content index and the PDF index so that the search results include both site content and PDFs that are in the Media folder.

    I am running Umbraco 6.

    thanks.

  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Aug 27, 2013 @ 10:59
    Ismail Mayat
    1

    Nick,

    You can do it with examine multi searcher see http://our.umbraco.org/forum/core/general/20321-Implementing-Multi-Index-Search-in-470 the configuration in the first post shows you how you create the searcher using config file although you can also do it programatically

            /// <summary>
        /// for given list of examine indexes it builds up a multi searcher so u can cross search indexes
        /// </summary>
        /// <param name="indexes"></param>
        /// <returns></returns>
        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;
        }
    

    You can then query in standard examine way. One issue i am having at the moment is that results all have score of 1 see http://our.umbraco.org/forum/developers/api-questions/44289-Examine-Multisearcher

    Regards

    Ismail

  • Mohammed BOUTEBEL 64 posts 103 karma points
    Sep 27, 2013 @ 10:35
    Mohammed BOUTEBEL
    0

    Hi Nick.

    I would like to know how do you index your pdf files in Examine ? I tried the CogUmbracoMediaIndexer package, but it never worked properly.

Please Sign in or register to post replies

Write your reply to:

Draft