1
votes

I have installed FullTextSearch (http://fulltextsearch.codeplex.com/) on my website and it is working good. Whatever keyword I type, FullTextSearch goes through content and tries to find that keyword.

But when I type some keyword which is only available in Media section in back-end of Umbraco, I can't find anything even with the fact that I have hunderds of files in Media folder??

Can anyone explain what is the issue and why FullTextSearch can't find anything from Media Section?

Many thanks in advance! Adi

1

1 Answers

4
votes

By default, Umbraco doesn't index media items. There's a plugin out there called Cog Umbraco Examine Media Indexer which adds an index for the media section of the site, and can index PDFs, Word and Excel files, text files, and other file types that the Apache Tika project can parse.

If you take the Media Indexer approach, then you'll have to customize your search page to utilize both the Full Text Search and Media Indexer indexes. our.umbraco.org provides one approach for combining multiple search indexes. Note that the Media Indexer creates an index named "MediaIndexSet" and the Full Text Search plugin creates an index named "FullTextIndexer".

EDIT

Here's an example of how you can create a MultiIndexSearcher to combine the two search indexes:

var indexes = new[] {"FullTextIndexer", "MediaIndexer"};
var directories = new List<DirectoryInfo>();
foreach (var index in indexes)
{
    var indexer = ExamineManager.Instance.IndexProviderCollection[index];
    var directory =
        new DirectoryInfo(
            ((LuceneIndexer) indexer).LuceneIndexFolder.FullName.Replace("\\Index", ""));
    directories.Add(directory);
}

var searcher = new MultiIndexSearcher(directories, new StandardAnalyzer());

Then you can use the searcher object to perform your searching:

var criteria = searcher.CreateSearchCriteria();
var query = criteria.RawQuery("name:\"search terms\""); // Replace with actual query
var results = searcher.Search(query);