Copied to clipboard

Flag this post as spam?

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


  • blackhawk 313 posts 1368 karma points
    Oct 05, 2017 @ 15:27
    blackhawk
    0

    Showing PDF results with Examine as a search provider

    Hopefully this is an easy one to solve and I am simply overlooking something here...I'm on Umbraco 7.6.6 and trying to get results displayed for PDFs that are currently indexed.

    • I applied steps from the following Examine Configuration here.
    • I have the UmbracoExamine.PDF.dll binary installed in my project.
    • I have the following 3 components in my Examine configuration files for sure...

    Item 1

    <add name="PDFSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine" />
    

    Item2

        <add name="PDFIndexer"
             type="UmbracoExamine.PDF.PDFIndexer, UmbracoExamine.PDF"
             extensions=".pdf"
             umbracoFileProperty="umbracoFile"/>
    

    item 3

     <IndexSet SetName="PDFIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/PDFIndexSet" />
    

    ...And here is a screenshot of my indexed PDF from BackOffice:

    enter image description here

    What must I do to my following MVC code to show the results of my pdf in which I am searching? The following code shows me no results....

      <form action="/basicsearch/" method="GET">
        <input type="text" placeholder="Search..." name="k">
        <button>Search</button>
      </form>
    
    @{
        var searchQuery = Request.QueryString["k"];
    
        if (!string.IsNullOrEmpty(searchQuery))
        {
            <div class="searchresults">
            <ul>
             @foreach (var result in Umbraco.TypedSearch(searchQuery))
              {
              <li>
                   @result.GetPropertyValue("umbracoExtension")
                   @result.GetPropertyValue("umbracoFile")
                   @result.CreateDate
               </li>
               }
               </ul>
               </div>
           }
     }
    

    Thanks in advance for any insight!

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Oct 05, 2017 @ 16:39
    Ismail Mayat
    100

    umbraco.typedsearch will default to the external indexer so that wont work as its looking at the wrong index.

    Are you looking to search only on that pdf index? If so then you need to use the examine api and get that index then run a query on it. If you are looking to search over combined index then you can update your config searcher to point to both indexes then search but you will need to when writing out results test if its pdf.

    Regards

    Ismail

  • blackhawk 313 posts 1368 karma points
    Oct 05, 2017 @ 17:08
    blackhawk
    0

    Yes I am going with option number 2 - a combined index. Quick question...

    example:

    <ExamineSearchProviders defaultProvider="CWSSearcher">
    ...
    
  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Oct 05, 2017 @ 17:26
    Ismail Mayat
    1

    Yeah you can set the default indexer there however you are going to want to search 2 indexes you need to update your ExamineSettings.config to:

    This will make the external searcher search of your content and pdf index. The issue however you may have is on your search call it may give you error because you have mix of content and pdf. So you may need to look at doing a query using examine api see https://our.umbraco.org/Documentation/Reference/Searching/Examine/examine-manager

    Regards

    Ismail

  • blackhawk 313 posts 1368 karma points
    Oct 05, 2017 @ 22:24
    blackhawk
    0

    Thanks again Ismail, I got something going based on the resources and tips you provided.

Please Sign in or register to post replies

Write your reply to:

Draft